From 4d000a704cbaff9710f67a4a01b76bc781751857 Mon Sep 17 00:00:00 2001 From: Sebastian Pape <0xneo11@gmail.com> Date: Mon, 1 Jul 2024 09:45:28 +0200 Subject: [PATCH] v2.11.4: fixes Solana RPC failover --- changelog.txt | 3 + depay-woocommerce-payments.php | 4 +- dist/web3-blockchains.js | 5 +- dist/web3-client.js | 79 ++++++++++++++++-------- dist/widgets.bundle.js | 4 +- languages/depay-woocommerce-payments.pot | 2 +- package.json | 2 +- readme.txt | 2 +- src/widgets.bundle.js | 4 +- 9 files changed, 68 insertions(+), 37 deletions(-) diff --git a/changelog.txt b/changelog.txt index 249cd93..d76d0c1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ *** DePay Web3 Payments for WooCommerce Changelog *** +2024-7-1 - version 2.11.4 +* fixes Solana RPC failover + 2024-6-17 - version 2.11.3 * fixes more mobile & wallet connect edgecases diff --git a/depay-woocommerce-payments.php b/depay-woocommerce-payments.php index c102735..fe5f007 100644 --- a/depay-woocommerce-payments.php +++ b/depay-woocommerce-payments.php @@ -11,7 +11,7 @@ * WC tested up to: 8.7.0 * Requires at least: 5.8 * Requires PHP: 7.0 - * Version: 2.11.3 + * Version: 2.11.4 * * @package DePay\Payments */ @@ -21,7 +21,7 @@ define( 'DEPAY_WC_PLUGIN_FILE', __FILE__ ); define( 'DEPAY_WC_ABSPATH', __DIR__ . '/' ); define( 'DEPAY_MIN_WC_ADMIN_VERSION', '0.23.2' ); -define( 'DEPAY_CURRENT_VERSION', '2.11.3' ); +define( 'DEPAY_CURRENT_VERSION', '2.11.4' ); require_once DEPAY_WC_ABSPATH . '/vendor/autoload.php'; diff --git a/dist/web3-blockchains.js b/dist/web3-blockchains.js index 1c032a8..67e26b0 100644 --- a/dist/web3-blockchains.js +++ b/dist/web3-blockchains.js @@ -250,9 +250,10 @@ if(address) { return `https://solscan.io/address/${address}` } }, endpoints: [ - 'https://solana.a.exodus.io', + 'https://swr.xnftdata.com/rpc-proxy', + 'https://solana-rpc.publicnode.com', 'https://mainnet-beta.solflare.network', - 'https://swr.xnftdata.com/rpc-proxy' + 'https://endpoints.omniatech.io/v1/sol/mainnet/public' ], sockets: [ 'wss://solana.drpc.org', diff --git a/dist/web3-client.js b/dist/web3-client.js index b1d3fa1..a19cfb9 100644 --- a/dist/web3-client.js +++ b/dist/web3-client.js @@ -35,6 +35,7 @@ function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } const BATCH_INTERVAL$1 = 10; const CHUNK_SIZE$1 = 99; + const MAX_RETRY$1 = 3; class StaticJsonRpcBatchProvider extends ethers.ethers.providers.JsonRpcProvider { @@ -51,7 +52,7 @@ return Promise.resolve(Blockchains__default["default"].findByName(this._network).id) } - requestChunk(chunk, endpoint) { + requestChunk(chunk, endpoint, attempt) { try { @@ -74,11 +75,11 @@ } }); }).catch((error) => { - if(error && error.code == 'SERVER_ERROR') { + if(attempt < MAX_RETRY$1 && error && error.code == 'SERVER_ERROR') { const index = this._endpoints.indexOf(this._endpoint)+1; this._failover(); this._endpoint = index >= this._endpoints.length ? this._endpoints[0] : this._endpoints[index]; - this.requestChunk(chunk, this._endpoint); + this.requestChunk(chunk, this._endpoint, attempt+1); } else { chunk.forEach((inflightRequest) => { inflightRequest.reject(error); @@ -132,7 +133,7 @@ chunks.forEach((chunk)=>{ // Get the request as an array of requests chunk.map((inflight) => inflight.request); - return this.requestChunk(chunk, this._endpoint) + return this.requestChunk(chunk, this._endpoint, 1) }); }, getConfiguration().batchInterval || BATCH_INTERVAL$1); } @@ -255,6 +256,7 @@ function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } const BATCH_INTERVAL = 10; const CHUNK_SIZE = 99; + const MAX_RETRY = 3; class StaticJsonRpcSequentialProvider extends solanaWeb3_js.Connection { @@ -269,30 +271,55 @@ this._rpcRequest = this._rpcRequestReplacement.bind(this); } - requestChunk(chunk) { + handleError(error, attempt, chunk) { + if(attempt < MAX_RETRY && error && [ + 'Failed to fetch', 'limit reached', '504', '503', '502', '500', '429', '426', '422', '413', '409', '408', '406', '405', '404', '403', '402', '401', '400' + ].some((errorType)=>error.toString().match(errorType))) { + const index = this._endpoints.indexOf(this._endpoint)+1; + this._endpoint = index >= this._endpoints.length ? this._endpoints[0] : this._endpoints[index]; + this._provider = new solanaWeb3_js.Connection(this._endpoint); + this.requestChunk(chunk, attempt+1); + } else { + chunk.forEach((inflightRequest) => { + inflightRequest.reject(error); + }); + } + } - const batch = chunk.map((inflight) => inflight.request); + batchRequest(requests, attempt) { + return new Promise((resolve, reject) => { + if (requests.length === 0) resolve([]); // Do nothing if requests is empty - const handleError = (error)=>{ - if(error && [ - 'Failed to fetch', 'limit reached', '504', '503', '502', '500', '429', '426', '422', '413', '409', '408', '406', '405', '404', '403', '402', '401', '400' - ].some((errorType)=>error.toString().match(errorType))) { - const index = this._endpoints.indexOf(this._endpoint)+1; - this._endpoint = index >= this._endpoints.length ? this._endpoints[0] : this._endpoints[index]; - this._provider = new solanaWeb3_js.Connection(this._endpoint); - this.requestChunk(chunk); - } else { - chunk.forEach((inflightRequest) => { - inflightRequest.reject(error); - }); - } - }; + const batch = requests.map(params => { + return this._rpcClient.request(params.methodName, params.args) + }); + + fetch( + this._endpoint, + { + method: 'POST', + body: JSON.stringify(batch), + headers: { 'Content-Type': 'application/json' }, + } + ).then((response)=>{ + if(response.ok) { + response.json().then((parsedJson)=>{ + resolve(parsedJson); + }).catch(reject); + } else { + reject(`${response.status} ${response.text}`); + } + }).catch(reject); + }) + } + + requestChunk(chunk, attempt) { + + const batch = chunk.map((inflight) => inflight.request); try { - return this._provider._rpcBatchRequest(batch) + return this.batchRequest(batch, attempt) .then((result) => { - // For each result, feed it to the correct Promise, depending - // on whether it was a success or error chunk.forEach((inflightRequest, index) => { const payload = result[index]; if (_optionalChain$2([payload, 'optionalAccess', _ => _.error])) { @@ -306,8 +333,8 @@ inflightRequest.reject(); } }); - }).catch(handleError) - } catch (error){ return handleError(error) } + }).catch((error)=>this.handleError(error, attempt, chunk)) + } catch (error){ return this.handleError(error, attempt, chunk) } } _rpcRequestReplacement(methodName, args) { @@ -343,7 +370,7 @@ chunks.forEach((chunk)=>{ // Get the request as an array of requests chunk.map((inflight) => inflight.request); - return this.requestChunk(chunk) + return this.requestChunk(chunk, 1) }); }, getConfiguration().batchInterval || BATCH_INTERVAL); } diff --git a/dist/widgets.bundle.js b/dist/widgets.bundle.js index 0e5e4c1..e18b413 100644 --- a/dist/widgets.bundle.js +++ b/dist/widgets.bundle.js @@ -6,8 +6,8 @@ O=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="functio /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ t.exports=n=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var r={},i=Object.prototype,o=i.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof p?e:p,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=N(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var f={};function p(){}function y(){}function m(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,w=v&&v(v(k([])));w&&w!==i&&o.call(w,s)&&(g=w);var b=m.prototype=p.prototype=Object.create(g);function M(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,n){function r(i,a,s,u){var c=d(t[i],t,a);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==e(h)&&o.call(h,"__await")?n.resolve(h.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):n.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var i;this._invoke=function(t,e){function o(){return new n((function(n,i){r(t,e,n,i)}))}return i=i?i.then(o,o):o()}}function N(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,N(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=d(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(ua)),ua.exports)();aa=t;try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":z(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}return aa}()),r=e((ha||(ha=1,function(t){function e(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}t.exports=function(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=t.apply(n,r);function s(t){e(a,i,o,s,u,"next",t)}function u(t){e(a,i,o,s,u,"throw",t)}s(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports}(fa)),fa.exports)),i=e(la()),o=e(ya()),a=e(va()),s=e(Na()),u=e(Ta()),c=e(ja()),l=Oa();function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,c.default)(t);if(e){var i=(0,c.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,u.default)(this,n)}}var d=function(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 i=0;for(r=Object.getOwnPropertySymbols(t);i1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;(0,o.default)(this,p);var a=r.autoconnect,s=void 0===a||a,u=r.reconnect,c=void 0===u||u,l=r.reconnect_interval,h=void 0===l?1e3:l,y=r.max_reconnects,m=void 0===y?5:y,g=d(r,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return(e=f.call(this)).webSocketFactory=t,e.queue={},e.rpc_id=0,e.address=n,e.autoconnect=s,e.ready=!1,e.reconnect=c,e.reconnect_timer_id=void 0,e.reconnect_interval=h,e.max_reconnects=m,e.rest_options=g,e.current_reconnects=0,e.generate_request_id=i||function(){return++e.rpc_id},e.autoconnect&&e._connect(e.address,Object.assign({autoconnect:e.autoconnect,reconnect:e.reconnect,reconnect_interval:e.reconnect_interval,max_reconnects:e.max_reconnects},e.rest_options)),e}return(0,a.default)(p,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(t,e,n,r){var o=this;return r||"object"!==(0,i.default)(n)||(r=n,n=null),new Promise((function(i,a){if(!o.ready)return a(new Error("socket not ready"));var s=o.generate_request_id(t,e),u={jsonrpc:"2.0",method:t,params:e||null,id:s};o.socket.send(JSON.stringify(u),r,(function(t){if(t)return a(t);o.queue[s]={promise:[i,a]},n&&(o.queue[s].timeout=setTimeout((function(){delete o.queue[s],a(new Error("reply timeout"))}),n))}))}))}},{key:"login",value:(l=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("rpc.login",e);case 2:if(r=t.sent){t.next=5;break}throw new Error("authentication failed");case 5:return t.abrupt("return",r);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return l.apply(this,arguments)})},{key:"listMethods",value:(c=(0,r.default)(n.default.mark((function t(){return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("__listMethods");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"notify",value:function(t,e){var n=this;return new Promise((function(r,i){if(!n.ready)return i(new Error("socket not ready"));var o={jsonrpc:"2.0",method:t,params:e||null};n.socket.send(JSON.stringify(o),(function(t){if(t)return i(t);r()}))}))}},{key:"subscribe",value:(u=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.on",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed subscribing to an event '"+e+"' with: "+r[e]);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"unsubscribe",value:(e=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.off",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed unsubscribing from an event with: "+r);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"close",value:function(t,e){this.socket.close(t||1e3,e)}},{key:"_connect",value:function(t,e){var n=this;clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",(function(){n.ready=!0,n.emit("open"),n.current_reconnects=0})),this.socket.addEventListener("message",(function(t){var e=t.data;e instanceof ArrayBuffer&&(e=It.from(e).toString());try{e=JSON.parse(e)}catch(t){return}if(e.notification&&n.listeners(e.notification).length){if(!Object.keys(e.params).length)return n.emit(e.notification);var r=[e.notification];if(e.params.constructor===Object)r.push(e.params);else for(var i=0;in.current_reconnects||0===n.max_reconnects)&&(n.reconnect_timer_id=setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval)))}))}}]),p}(l.EventEmitter);t.default=f}(na);var za=S(na),Pa={};!function(t){var e=ra.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t,e){return new u(t,e)};var n=e(ya()),r=e(va()),i=e(Na()),o=e(Ta()),a=e(ja());function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,a.default)(t);if(e){var i=(0,a.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,o.default)(this,n)}}var u=function(t){(0,i.default)(o,t);var e=s(o);function o(t,r,i){var a;return(0,n.default)(this,o),(a=e.call(this)).socket=new window.WebSocket(t,i),a.socket.onopen=function(){return a.emit("open")},a.socket.onmessage=function(t){return a.emit("message",t.data)},a.socket.onerror=function(t){return a.emit("error",t)},a.socket.onclose=function(t){a.emit("close",t.code,t.reason)},a}return(0,r.default)(o,[{key:"send",value:function(t,e,n){var r=n||e;try{this.socket.send(t),r()}catch(t){r(t)}}},{key:"close",value:function(t,e){this.socket.close(t,e)}},{key:"addEventListener",value:function(t,e,n){this.socket.addEventListener(t,e,n)}}]),o}(Oa().EventEmitter)}(Pa);for(var _a=S(Pa),Ba=[],Ra=[],Ua=[],Qa=BigInt(0),Ya=BigInt(1),Wa=BigInt(2),Fa=BigInt(7),Va=BigInt(256),Ha=BigInt(113),Ga=0,qa=Ya,Za=1,Ja=0;Ga<24;Ga++){var Xa=[Ja,(2*Za+3*Ja)%5];Za=Xa[0],Ja=Xa[1],Ba.push(2*(5*Ja+Za)),Ra.push((Ga+1)*(Ga+2)/2%64);for(var Ka=Qa,$a=0;$a<7;$a++)(qa=(qa<>Fa)*Ha)%Va)&Wa&&(Ka^=Ya<<(Ya<32?De(t,e,n):je(t,e,n)},is=function(t,e,n){return n>32?Oe(t,e,n):Ce(t,e,n)},os=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(B(this,n),(o=e.call(this)).blockLen=t,o.suffix=r,o.outputLen=i,o.enableXOF=a,o.rounds=s,o.pos=0,o.posOut=0,o.finished=!1,o.destroyed=!1,le(i),0>=o.blockLen||o.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");return o.state=new Uint8Array(200),o.state32=me(o.state),o}return U(n,[{key:"keccak",value:function(){!function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24,n=new Uint32Array(10),r=24-e;r<24;r++){for(var i=0;i<10;i++)n[i]=t[i]^t[i+10]^t[i+20]^t[i+30]^t[i+40];for(var o=0;o<10;o+=2)for(var a=(o+8)%10,s=(o+2)%10,u=n[s],c=n[s+1],l=rs(u,c,1)^n[a],h=is(u,c,1)^n[a+1],d=0;d<50;d+=10)t[o+d]^=l,t[o+d+1]^=h;for(var f=t[2],p=t[3],y=0;y<24;y++){var m=Ra[y],g=rs(f,p,m),v=is(f,p,m),w=Ba[y];f=t[w],p=t[w+1],t[w]=g,t[w+1]=v}for(var b=0;b<50;b+=10){for(var M=0;M<10;M++)n[M]=t[b+M];for(var A=0;A<10;A++)t[b+A]^=~n[(A+2)%10]&n[(A+4)%10]}t[0]^=es[r],t[1]^=ns[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}},{key:"update",value:function(t){fe(this);for(var e=this.blockLen,n=this.state,r=(t=Me(t)).length,i=0;i=n&&this.keccak();var o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}},{key:"xofInto",value:function(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}},{key:"xof",value:function(t){return le(t),this.xofInto(new Uint8Array(t))}},{key:"digestInto",value:function(t){if(pe(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}},{key:"digest",value:function(){return this.digestInto(new Uint8Array(this.outputLen))}},{key:"destroy",value:function(){this.destroyed=!0,this.state.fill(0)}},{key:"_cloneInto",value:function(t){var e=this.blockLen,r=this.suffix,i=this.outputLen,o=this.rounds,a=this.enableXOF;return t||(t=new n(e,r,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}}]),n}(Ne),as=Ie((function(){return new os(136,1,32)})),ss=$e,us=Ke,cs={Err:function(t){Y(n,t);var e=X(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return B(this,n),e.call(this,t)}return U(n)}(G(Error)),_parseInt:function(t){var e=cs.Err;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");var n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:ss(r),l:t.subarray(n+2)}},toSig:function(t){var e=cs.Err,n="string"==typeof t?us(t):t;if(!He(n))throw new Error("ui8a expected");var r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");var i=cs._parseInt(n.subarray(2)),o=i.d,a=i.l,s=cs._parseInt(a),u=s.d;if(s.l.length)throw new e("Invalid signature: left bytes after parsing");return{r:o,s:u}},hexFromSig:function(t){var e=function(t){return 8&Number.parseInt(t[0],16)?"00"+t:t},n=function(t){var e=t.toString(16);return 1&e.length?"0".concat(e):e},r=e(n(t.s)),i=e(n(t.r)),o=r.length/2,a=i.length/2,s=n(o),u=n(a);return"30".concat(n(a+o+4),"02").concat(u).concat(i,"02").concat(s).concat(r)}},ls=BigInt(0),hs=BigInt(1);BigInt(2);var ds=BigInt(3);function fs(t){var e,n=(hn(e=zn(t),{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze(D({lowS:!0},e))),r=n.Fp,i=n.n,o=r.BYTES+1,a=2*r.BYTES+1;function s(t){return bn(t,i)}function u(t){return Nn(t,i)}var c=function(t){var e=function(t){var e=zn(t);hn(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});var n=e.endo,r=e.Fp,i=e.a;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!==z(n)||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze(D({},e))}(t),n=e.Fp,r=e.toBytes||function(t,e,r){var i=e.toAffine();return on(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))},i=e.fromBytes||function(t){var e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}};function o(t){var r=e.a,i=e.b,o=n.sqr(t),a=n.mul(o,t);return n.add(n.add(a,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(t){return"bigint"==typeof t&&lsls||h>ls;)c&hs&&(d=d.add(y)),h&hs&&(p=p.add(y)),y=y.double(),c>>=hs,h>>=hs;return u&&(d=d.negate()),l&&(p=p.negate()),p=new t(n.mul(p.px,o.beta),p.py,p.pz),d.add(p)}},{key:"multiply",value:function(r){s(r);var i,o,a=r,u=e.endo;if(u){var c=u.splitScalar(a),l=c.k1neg,h=c.k1,d=c.k2neg,p=c.k2,y=this.wNAF(h),m=y.p,g=y.f,v=this.wNAF(p),w=v.p,b=v.f;m=f.constTimeNegate(l,m),w=f.constTimeNegate(d,w),w=new t(n.mul(w.px,u.beta),w.py,w.pz),i=m.add(w),o=g.add(b)}else{var M=this.wNAF(a);i=M.p,o=M.f}return t.normalizeZ([i,o])[0]}},{key:"multiplyAndAddUnsafe",value:function(e,n,r){var i=t.BASE,o=function(t,e){return e!==ls&&e!==hs&&t.equals(i)?t.multiply(e):t.multiplyUnsafe(e)},a=o(this,n).add(o(e,r));return a.is0()?void 0:a}},{key:"toAffine",value:function(t){var e=this.px,r=this.py,i=this.pz,o=this.is0();null==t&&(t=o?n.ONE:n.inv(i));var a=n.mul(e,t),s=n.mul(r,t),u=n.mul(i,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:a,y:s}}},{key:"isTorsionFree",value:function(){var n=e.h,r=e.isTorsionFree;if(n===hs)return!0;if(r)return r(t,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}},{key:"clearCofactor",value:function(){var n=e.h,r=e.clearCofactor;return n===hs?this:r?r(t,this):this.multiplyUnsafe(e.h)}},{key:"toRawBytes",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.assertValidity(),r(t,this,e)}},{key:"toHex",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return qe(this.toRawBytes(t))}}],[{key:"fromAffine",value:function(e){var r=e||{},i=r.x,o=r.y;if(!e||!n.isValid(i)||!n.isValid(o))throw new Error("invalid affine point");if(e instanceof t)throw new Error("projective point not allowed");var a=function(t){return n.eql(t,n.ZERO)};return a(i)&&a(o)?t.ZERO:new t(i,o,n.ONE)}},{key:"normalizeZ",value:function(e){var r=n.invertBatch(e.map((function(t){return t.pz})));return e.map((function(t,e){return t.toAffine(r[e])})).map(t.fromAffine)}},{key:"fromHex",value:function(e){var n=t.fromAffine(i(rn("pointHex",e)));return n.assertValidity(),n}},{key:"fromPrivateKey",value:function(e){return t.BASE.multiply(u(e))}}]),t}();h.BASE=new h(e.Gx,e.Gy,n.ONE),h.ZERO=new h(n.ZERO,n.ONE,n.ZERO);var d=e.nBitLength,f=On(h,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}(D(D({},n),{},{toBytes:function(t,e,n){var i=e.toAffine(),o=r.toBytes(i.x),a=on;return n?a(Uint8Array.from([e.hasEvenY()?2:3]),o):a(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes:function(t){var e=t.length,n=t[0],i=t.subarray(1);if(e!==o||2!==n&&3!==n){if(e===a&&4===n)return{x:r.fromBytes(i.subarray(0,r.BYTES)),y:r.fromBytes(i.subarray(r.BYTES,2*r.BYTES))};throw new Error("Point of length ".concat(e," was invalid. Expected ").concat(o," compressed bytes or ").concat(a," uncompressed bytes"))}var s=$e(i);if(!(ls<(u=s)&&ui>>hs}function m(t){return y(t)?s(-t):t}var g=function(t,e,n){return $e(t.slice(e,n))},v=function(){function t(e,n,r){B(this,t),this.r=e,this.s=n,this.recovery=r,this.assertValidity()}return U(t,[{key:"assertValidity",value:function(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}},{key:"addRecoveryBit",value:function(e){return new t(this.r,this.s,e)}},{key:"recoverPublicKey",value:function(t){var e=this.r,i=this.s,o=this.recovery,a=A(rn("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");var c=2===o||3===o?e+n.n:e;if(c>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");var h=0==(1&o)?"02":"03",d=l.fromHex(h+p(c)),f=u(c),y=s(-a*f),m=s(i*f),g=l.BASE.multiplyAndAddUnsafe(d,y,m);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}},{key:"hasHighS",value:function(){return y(this.s)}},{key:"normalizeS",value:function(){return this.hasHighS()?new t(this.r,s(-this.s),this.recovery):this}},{key:"toDERRawBytes",value:function(){return Ke(this.toDERHex())}},{key:"toDERHex",value:function(){return cs.hexFromSig({r:this.r,s:this.s})}},{key:"toCompactRawBytes",value:function(){return Ke(this.toCompactHex())}},{key:"toCompactHex",value:function(){return p(this.r)+p(this.s)}}],[{key:"fromCompact",value:function(e){var r=n.nByteLength;return e=rn("compactSignature",e,2*r),new t(g(e,0,r),g(e,r,2*r))}},{key:"fromDER",value:function(e){var n=cs.toSig(rn("DER",e));return new t(n.r,n.s)}}]),t}(),w={isValidPrivateKey:function(t){try{return h(t),!0}catch(t){return!1}},normPrivateKeyToScalar:h,randomPrivateKey:function(){var t=jn(n.n);return function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.length,i=Sn(e),o=jn(e);if(r<16||r1024)throw new Error("expected ".concat(o,"-1024 bytes of input, got ").concat(r));var a=bn(n?$e(t):tn(t),e-pn)+pn;return n?nn(a,i):en(a,i)}(n.randomBytes(t),n.n)},precompute:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.BASE;return e._setWindowSize(t),e.multiply(BigInt(3)),e}};function b(t){var e=He(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===o||r===a:n?r===2*o||r===2*a:t instanceof l}var M=n.bits2int||function(t){var e=$e(t),r=8*t.length-n.nBitLength;return r>0?e>>BigInt(r):e},A=n.bits2int_modN||function(t){return s(M(t))},N=an(n.nBitLength);function I(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(ls<=t&&t2&&void 0!==arguments[2]?arguments[2]:x;if(["recovered","canonical"].some((function(t){return t in i})))throw new Error("sign() legacy options not supported");var o=n.hash,a=n.randomBytes,c=i.lowS,d=i.prehash,p=i.extraEntropy;null==c&&(c=!0),t=rn("msgHash",t),d&&(t=rn("prehashed msgHash",o(t)));var g=A(t),w=h(e),b=[I(w),I(g)];if(null!=p){var N=!0===p?a(r.BYTES):p;b.push(rn("extraEntropy",N))}var E=on.apply(dn,b),k=g;function T(t){var e=M(t);if(f(e)){var n=u(e),r=l.BASE.multiply(e).toAffine(),i=s(r.x);if(i!==ls){var o=s(n*s(k+i*w));if(o!==ls){var a=(r.x===i?0:2)|Number(r.y&hs),h=o;return c&&y(o)&&(h=m(o),a^=1),new v(i,h,a)}}}}return{seed:E,k2sig:T}}var x={lowS:n.lowS,prehash:!1},k={lowS:n.lowS,prehash:!1};return l.BASE._setWindowSize(8),{CURVE:n,getPublicKey:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return l.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(b(t))throw new Error("first arg must be private key");if(!b(e))throw new Error("second arg must be public key");var r=l.fromHex(e);return r.multiply(h(t)).toRawBytes(n)},sign:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:x,i=E(t,e,r),o=i.seed,a=i.k2sig,s=n,u=cn(s.hash.outputLen,s.nByteLength,s.hmac);return u(o,a)},verify:function(t,e,r){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:k,a=t;if(e=rn("msgHash",e),r=rn("publicKey",r),"strict"in o)throw new Error("options.strict was renamed to lowS");var c,h=o.lowS,d=o.prehash,f=void 0;try{if("string"==typeof a||He(a))try{f=v.fromDER(a)}catch(t){if(!(t instanceof cs.Err))throw t;f=v.fromCompact(a)}else{if("object"!==z(a)||"bigint"!=typeof a.r||"bigint"!=typeof a.s)throw new Error("PARSE");var p=a.r,y=a.s;f=new v(p,y)}c=l.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(h&&f.hasHighS())return!1;d&&(e=n.hash(e));var m=f,g=m.r,w=m.s,b=A(e),M=u(w),N=s(b*M),I=s(g*M),E=null===(i=l.BASE.multiplyAndAddUnsafe(c,N,I))||void 0===i?void 0:i.toAffine();if(!E)return!1;var x=s(E.x);return x===g},ProjectivePoint:l,Signature:v,utils:w}}BigInt(4);var ps=function(t){Y(n,t);var e=X(n);function n(t,r){var i;B(this,n),(i=e.call(this)).finished=!1,i.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");le(t.outputLen),le(t.blockLen)}(t);var o=Me(r);if(i.iHash=t.create(),"function"!=typeof i.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");i.blockLen=i.iHash.blockLen,i.outputLen=i.iHash.outputLen;var a=i.blockLen,s=new Uint8Array(a);s.set(o.length>a?t.create().update(o).digest():o);for(var u=0;ua,d=l>a;if(h&&(c=e-c),d&&(l=e-l),c>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:h,k1:c,k2neg:d,k2:l}}}},gs=dr,vs=function(t){return fs(D(D({},ms),function(t){return{hash:t,hmac:function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;iQs)throw new Error("Invalid public key input")}return e}return U(a,[{key:"equals",value:function(t){return this._bn.eq(t._bn)}},{key:"toBase58",value:function(){return ar.encode(this.toBytes())}},{key:"toJSON",value:function(){return this.toBase58()}},{key:"toBytes",value:function(){var t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}},{key:"toBuffer",value:function(){var t=this._bn.toArrayLike(It);if(t.length===Qs)return t;var e=It.alloc(32);return t.copy(e,32-t.length),e}},{key:e,get:function(){return"PublicKey(".concat(this.toString(),")")}},{key:"toString",value:function(){return this.toBase58()}}],[{key:"unique",value:function(){var t=new a(Ys);return Ys+=1,new a(t.toBuffer())}},{key:"createWithSeed",value:(i=_(O().mark((function t(e,n,r){var i,o;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=It.concat([e.toBuffer(),It.from(n),r.toBuffer()]),o=dr(i),t.abrupt("return",new a(o));case 3:case"end":return t.stop()}}),t)}))),function(t,e,n){return i.apply(this,arguments)})},{key:"createProgramAddressSync",value:function(t,e){var n=It.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");n=It.concat([n,_s(t)])})),n=It.concat([n,e.toBuffer(),It.from("ProgramDerivedAddress")]);var r=dr(n);if(Ds(r))throw new Error("Invalid seeds, address must fall off the curve");return new a(r)}},{key:"createProgramAddress",value:(r=_(O().mark((function t(e,n){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.createProgramAddressSync(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"findProgramAddressSync",value:function(t,e){for(var n,r=255;0!=r;){try{var i=t.concat(It.from([r]));n=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}},{key:"findProgramAddress",value:(n=_(O().mark((function t(e,n){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.findProgramAddressSync(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"isOnCurve",value:function(t){return Ds(new a(t).toBytes())}}]),a}(Bs,Symbol.toStringTag);Os=Ws,Ws.default=new Os("11111111111111111111111111111111"),Us.set(Ws,{kind:"struct",fields:[["_bn","u256"]]});var Fs=function(){function t(e){if(B(this,t),this._publicKey=void 0,this._secretKey=void 0,e){var n=_s(e);if(64!==e.length)throw new Error("bad secret key size");this._publicKey=n.slice(32,64),this._secretKey=n.slice(0,32)}else this._secretKey=_s(Ss()),this._publicKey=_s(Cs(this._secretKey))}return U(t,[{key:"publicKey",get:function(){return new Ws(this._publicKey)}},{key:"secretKey",get:function(){return It.concat([this._secretKey,this._publicKey],64)}}]),t}(),Vs=new Ws("BPFLoader1111111111111111111111111111111111"),Hs=1232,Gs=127,qs=64,Zs=function(t){Y(n,t);var e=X(n);function n(t){var r;return B(this,n),(r=e.call(this,"Signature ".concat(t," has expired: block height exceeded."))).signature=void 0,r.signature=t,r}return U(n)}(G(Error));Object.defineProperty(Zs.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var Js=function(t){Y(n,t);var e=X(n);function n(t,r){var i;return B(this,n),(i=e.call(this,"Transaction was not confirmed in ".concat(r.toFixed(2)," seconds. It is ")+"unknown if it succeeded or failed. Check signature "+"".concat(t," using the Solana Explorer or CLI tools."))).signature=void 0,i.signature=t,i}return U(n)}(G(Error));Object.defineProperty(Js.prototype,"name",{value:"TransactionExpiredTimeoutError"});var Xs=function(t){Y(n,t);var e=X(n);function n(t){var r;return B(this,n),(r=e.call(this,"Signature ".concat(t," has expired: the nonce is no longer valid."))).signature=void 0,r.signature=t,r}return U(n)}(G(Error));Object.defineProperty(Xs.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});var Ks=function(){function t(e,n){B(this,t),this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=n}return U(t,[{key:"keySegments",value:function(){var t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}},{key:"get",value:function(t){var e,n=st(this.keySegments());try{for(n.s();!(e=n.n()).done;){var r=e.value;if(t256)throw new Error("Account index overflow encountered during compilation");var e=new Map;this.keySegments().flat().forEach((function(t,n){e.set(t.toBase58(),n)}));var n=function(t){var n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((function(t){return{programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((function(t){return n(t.pubkey)})),data:t.data}}))}}]),t}(),$s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey";return Wi(32,t)},tu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature";return Wi(64,t)},eu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",e=Qi([Bi("length"),Bi("lengthPadding"),Wi(zi(Bi(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),i=e;return i.decode=function(t,e){return n(t,e).chars.toString()},i.encode=function(t,e,n){var i={chars:It.from(t,"utf8")};return r(i,e,n)},i.alloc=function(t){return Bi().span+Bi().span+It.from(t,"utf8").length},i};function nu(t,e){var n=function t(n){if(n.span>=0)return n.span;if("function"==typeof n.alloc)return n.alloc(e[n.property]);if("count"in n&&"elementLayout"in n){var r=e[n.property];if(Array.isArray(r))return r.length*t(n.elementLayout)}else if("fields"in n)return nu({layout:n},e[n.property]);return 0},r=0;return t.layout.fields.forEach((function(t){r+=n(t)})),r}function ru(t){for(var e=0,n=0;;){var r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function iu(t,e){for(var n=e;;){var r=127&n;if(0==(n>>=7)){t.push(r);break}r|=128,t.push(r)}}function ou(t,e){if(!t)throw new Error(e||"Assertion failed")}var au=function(){function t(e,n){B(this,t),this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=n}return U(t,[{key:"getMessageComponents",value:function(){var t=et(this.keyMetaMap.entries());ou(t.length<=256,"Max static account keys length exceeded");var e=t.filter((function(t){var e=tt(t,2)[1];return e.isSigner&&e.isWritable})),n=t.filter((function(t){var e=tt(t,2)[1];return e.isSigner&&!e.isWritable})),r=t.filter((function(t){var e=tt(t,2)[1];return!e.isSigner&&e.isWritable})),i=t.filter((function(t){var e=tt(t,2)[1];return!e.isSigner&&!e.isWritable})),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};return ou(e.length>0,"Expected at least one writable signer key"),ou(tt(e[0],1)[0]===this.payer.toBase58(),"Expected first writable signer key to be the fee payer"),[o,[].concat(et(e.map((function(t){var e=tt(t,1)[0];return new Ws(e)}))),et(n.map((function(t){var e=tt(t,1)[0];return new Ws(e)}))),et(r.map((function(t){var e=tt(t,1)[0];return new Ws(e)}))),et(i.map((function(t){var e=tt(t,1)[0];return new Ws(e)}))))]}},{key:"extractTableLookup",value:function(t){var e=tt(this.drainKeysFoundInLookupTable(t.state.addresses,(function(t){return!t.isSigner&&!t.isInvoked&&t.isWritable})),2),n=e[0],r=e[1],i=tt(this.drainKeysFoundInLookupTable(t.state.addresses,(function(t){return!t.isSigner&&!t.isInvoked&&!t.isWritable})),2),o=i[0],a=i[1];if(0!==n.length||0!==o.length)return[{accountKey:t.key,writableIndexes:n,readonlyIndexes:o},{writable:r,readonly:a}]}},{key:"drainKeysFoundInLookupTable",value:function(t,e){var n,r=this,i=new Array,o=new Array,a=st(this.keyMetaMap.entries());try{var s=function(){var a=tt(n.value,2),s=a[0],u=a[1];if(e(u)){var c=new Ws(s),l=t.findIndex((function(t){return t.equals(c)}));l>=0&&(ou(l<256,"Max lookup table index exceeded"),i.push(l),o.push(c),r.keyMetaMap.delete(s))}};for(a.s();!(n=a.n()).done;)s()}catch(t){a.e(t)}finally{a.f()}return[i,o]}}],[{key:"compile",value:function(e,n){var r=new Map,i=function(t){var e=t.toBase58(),n=r.get(e);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(e,n)),n},o=i(n);o.isSigner=!0,o.isWritable=!0;var a,s=st(e);try{for(s.s();!(a=s.n()).done;){var u=a.value;i(u.programId).isInvoked=!0;var c,l=st(u.keys);try{for(l.s();!(c=l.n()).done;){var h=c.value,d=i(h.pubkey);d.isSigner||(d.isSigner=h.isSigner),d.isWritable||(d.isWritable=h.isWritable)}}catch(t){l.e(t)}finally{l.f()}}}catch(t){s.e(t)}finally{s.f()}return new t(n,r)}}]),t}(),su=function(){function t(e){var n=this;B(this,t),this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map((function(t){return new Ws(t)})),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach((function(t){return n.indexToProgramIds.set(t.programIdIndex,n.accountKeys[t.programIdIndex])}))}return U(t,[{key:"version",get:function(){return"legacy"}},{key:"staticAccountKeys",get:function(){return this.accountKeys}},{key:"compiledInstructions",get:function(){return this.instructions.map((function(t){return{programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:ar.decode(t.data)}}))}},{key:"addressTableLookups",get:function(){return[]}},{key:"getAccountKeys",value:function(){return new Ks(this.staticAccountKeys)}},{key:"isAccountSigner",value:function(t){return t=this.header.numRequiredSignatures?t-e0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new Ks(this.staticAccountKeys,e)}},{key:"isAccountSigner",value:function(t){return t=n?t-n=this.header.numRequiredSignatures?t-e0?this.signatures[0].signature:null}},{key:"toJSON",value:function(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((function(t){return t.toJSON()})),signers:this.signatures.map((function(t){return t.publicKey.toJSON()}))}}},{key:"add",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(var r=0;r-1?(a[n].isWritable=a[n].isWritable||t.isWritable,a[n].isSigner=a[n].isSigner||t.isSigner):a.push(t)})),a.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));var s=a.findIndex((function(t){return t.pubkey.equals(n)}));if(s>-1){var u=tt(a.splice(s,1),1)[0];u.isSigner=!0,u.isWritable=!0,a.unshift(u)}else a.unshift({pubkey:n,isSigner:!0,isWritable:!0});var c,l=st(this.signatures);try{var h=function(){var t=c.value,e=a.findIndex((function(e){return e.pubkey.equals(t.publicKey)}));if(!(e>-1))throw new Error("unknown signer: ".concat(t.publicKey.toString()));a[e].isSigner||(a[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))};for(l.s();!(c=l.n()).done;)h()}catch(t){l.e(t)}finally{l.f()}var d=0,f=0,p=0,y=[],m=[];a.forEach((function(t){var e=t.pubkey,n=t.isSigner,r=t.isWritable;n?(y.push(e.toString()),d+=1,r||(f+=1)):(m.push(e.toString()),r||(p+=1))}));var g=y.concat(m),v=e.map((function(t){var e=t.data,n=t.programId;return{programIdIndex:g.indexOf(n.toString()),accounts:t.keys.map((function(t){return g.indexOf(t.pubkey.toString())})),data:ar.encode(e)}}));return v.forEach((function(t){ou(t.programIdIndex>=0),t.accounts.forEach((function(t){return ou(t>=0)}))})),new su({header:{numRequiredSignatures:d,numReadonlySignedAccounts:f,numReadonlyUnsignedAccounts:p},accountKeys:g,recentBlockhash:t,instructions:v})}},{key:"_compile",value:function(){var t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every((function(t,n){return e[n].equals(t.publicKey)}))||(this.signatures=e.map((function(t){return{signature:null,publicKey:t}}))),t}},{key:"serializeMessage",value:function(){return this._compile().serialize()}},{key:"getEstimatedFee",value:(e=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getFeeForMessage(this.compileMessage());case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"setSigners",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n1?r-1:0),o=1;o ").concat(Hs)),i}},{key:"keys",get:function(){return ou(1===this.instructions.length),this.instructions[0].keys.map((function(t){return t.pubkey}))}},{key:"programId",get:function(){return ou(1===this.instructions.length),this.instructions[0].programId}},{key:"data",get:function(){return ou(1===this.instructions.length),this.instructions[0].data}}],[{key:"from",value:function(e){for(var n=et(e),r=ru(n),i=[],o=0;o1&&void 0!==arguments[1]?arguments[1]:[],r=new t;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),n.forEach((function(t,n){var i={signature:t==ar.encode(hu)?null:ar.decode(t),publicKey:e.accountKeys[n]};r.signatures.push(i)})),e.instructions.forEach((function(t){var n=t.accounts.map((function(t){var n=e.accountKeys[t];return{pubkey:n,isSigner:r.signatures.some((function(t){return t.publicKey.toString()===n.toString()}))||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}}));r.instructions.push(new du({keys:n,programId:e.accountKeys[t.programIdIndex],data:ar.decode(t.data)}))})),r._message=e,r._json=r.toJSON(),r}}]),t}(),pu=function(){function t(e){B(this,t),this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}return U(t,[{key:"compileToLegacyMessage",value:function(){return su.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}},{key:"compileToV0Message",value:function(t){return uu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:t})}}],[{key:"decompile",value:function(e,n){var r=e.header,i=e.compiledInstructions,o=e.recentBlockhash,a=r.numRequiredSignatures,s=r.numReadonlySignedAccounts,u=r.numReadonlyUnsignedAccounts,c=a-s;ou(c>0,"Message header is invalid");var l=e.staticAccountKeys.length-a-u;ou(l>=0,"Message header is invalid");var h=e.getAccountKeys(n),d=h.get(0);if(void 0===d)throw new Error("Failed to decompile message because no account keys were found");var f,p=[],y=st(i);try{for(y.s();!(f=y.n()).done;){var m,g=f.value,v=[],w=st(g.accountKeyIndexes);try{for(w.s();!(m=w.n()).done;){var b,M=m.value,A=h.get(M);if(void 0===A)throw new Error("Failed to find key for account key index ".concat(M));b=M=0,"Cannot sign with non signer key ".concat(t.publicKey.toBase58())),n.signatures[o]=zs(r,t.secretKey)};for(o.s();!(e=o.n()).done;)a()}catch(t){o.e(t)}finally{o.f()}}},{key:"addSignature",value:function(t,e){ou(64===e.byteLength,"Signature must be 64 bytes long");var n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((function(e){return e.equals(t)}));ou(n>=0,"Can not add signature; `".concat(t.toBase58(),"` is not required to sign this transaction")),this.signatures[n]=e}}],[{key:"deserialize",value:function(e){for(var n=et(e),r=[],i=ru(n),o=0;o=0?t.layout.span:nu(t,e),r=It.alloc(n),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,r),r}function Lu(t,e){var n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error("invalid instruction; instruction index mismatch ".concat(n.instruction," != ").concat(t.index));return n}var Su=Ri("lamportsPerSignature"),ju=Qi([Bi("version"),Bi("state"),$s("authorizedPubkey"),$s("nonce"),Qi([Su],"feeCalculator")]),Cu=ju.span,Du=function(){function t(e){B(this,t),this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}return U(t,null,[{key:"fromAccountData",value:function(e){var n=ju.decode(_s(e),0);return new t({authorizedPubkey:new Ws(n.authorizedPubkey),nonce:new Ws(n.nonce).toString(),feeCalculator:n.feeCalculator})}}]),t}(),Ou=function(t){var e=Wi(8,t),n=function(t){return{decode:t.decode.bind(t),encode:t.encode.bind(t)}}(e),r=n.encode,i=n.decode,o=e;return o.decode=function(t,e){var n=i(t,e);return Vi(It.from(n))},o.encode=function(t,e,n){var i=Hi(t,8);return r(i,e,n)},o},zu=function(){function t(){B(this,t)}return U(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=Bi("instruction").decode(t.data),r=0,i=Object.entries(Pu);r0?s:1,space:a.length,programId:o}));case 17:if(null===c){e.next=20;break}return e.next=20,Eu(n,c,[r,i],{commitment:"confirmed"});case 20:l=Qi([Bi("instruction"),Bi("offset"),Bi("bytesLength"),Bi("bytesLengthPadding"),Yi(Pi("byte"),zi(Bi(),-8),"bytes")]),h=t.chunkSize,d=0,f=a,p=[];case 25:if(!(f.length>0)){e.next=39;break}if(y=f.slice(0,h),m=It.alloc(h+16),l.encode({instruction:0,offset:d,bytes:y,bytesLength:0,bytesLengthPadding:0},m),g=(new fu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:m}),p.push(Eu(n,g,[r,i],{commitment:"confirmed"})),!n._rpcEndpoint.includes("solana.com")){e.next=35;break}return e.next=35,ku(250);case 35:d+=h,f=f.slice(h),e.next=25;break;case 39:return e.next=41,Promise.all(p);case 41:return v=Qi([Bi("instruction")]),w=It.alloc(v.span),v.encode({instruction:1},w),b=(new fu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0},{pubkey:bu,isSigner:!1,isWritable:!1}],programId:o,data:w}),M="processed",e.next=48,n.sendTransaction(b,[r,i],{preflightCommitment:M});case 48:return A=e.sent,e.next=51,n.confirmTransaction({signature:A,lastValidBlockHeight:b.lastValidBlockHeight,blockhash:b.recentBlockhash},M);case 51:if(N=e.sent,I=N.context,!(E=N.value).err){e.next=56;break}throw new Error("Transaction ".concat(A," failed (").concat(JSON.stringify(E),")"));case 56:return e.prev=57,e.next=60,n.getSlot({commitment:M});case 60:if(!(e.sent>I.slot)){e.next=63;break}return e.abrupt("break",71);case 63:e.next=67;break;case 65:e.prev=65,e.t0=e.catch(57);case 67:return e.next=69,new Promise((function(t){return setTimeout(t,Math.round(200))}));case 69:e.next=56;break;case 71:return e.abrupt("return",!0);case 72:case"end":return e.stop()}}),e,null,[[57,65]])}))),function(t,n,r,i,o){return e.apply(this,arguments)})}]),t}();Bu.chunkSize=932;var Ru=new Ws("BPFLoader2111111111111111111111111111111111"),Uu=function(){function t(){B(this,t)}return U(t,null,[{key:"getMinNumSignatures",value:function(t){return Bu.getMinNumSignatures(t)}},{key:"load",value:function(t,e,n,r,i){return Bu.load(t,e,n,i,r)}}]),t}(),Qu=Object.prototype.toString,Yu=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function Wu(t,e){var n,r,i,o,a,s,u;if(!0===t)return"true";if(!1===t)return"false";switch(z(t)){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return Wu(t.toJSON(),e);if("[object Array]"===(u=Qu.call(t))){for(i="[",r=t.length-1,n=0;n-1&&(i+=Wu(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=Yu(t).sort()).length,i="",n=0;n1;)t/=2,e++;return e}var Hu=function(){function t(e,n,r,i,o){B(this,t),this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=n,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=o}return U(t,[{key:"getEpoch",value:function(t){return this.getEpochAndSlotIndex(t)[0]}},{key:"getEpochAndSlotIndex",value:function(t){if(t>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32))}(t+32+1))-Vu(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}var n=t-this.firstNormalSlot,r=Math.floor(n/this.slotsPerEpoch);return[this.firstNormalEpoch+r,n%this.slotsPerEpoch]}},{key:"getFirstSlotInEpoch",value:function(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}},{key:"getLastSlotInEpoch",value:function(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}},{key:"getSlotsInEpoch",value:function(t){return t0&&(i.until=a.signatures[a.signatures.length-1].toString()),t.next=22;break;case 15:if(t.prev=15,t.t0=t.catch(8),!(t.t0 instanceof Error&&t.t0.message.includes("skipped"))){t.next=21;break}return t.abrupt("continue",4);case 21:throw t.t0;case 22:t.next=4;break;case 24:return t.next=26,this.getSlot("finalized");case 26:s=t.sent;case 27:if("before"in i){t.next=47;break}if(!(++r>s)){t.next=31;break}return t.abrupt("break",47);case 31:return t.prev=31,t.next=34,this.getConfirmedBlockSignatures(r);case 34:(u=t.sent).signatures.length>0&&(i.before=u.signatures[u.signatures.length-1].toString()),t.next=45;break;case 38:if(t.prev=38,t.t1=t.catch(31),!(t.t1 instanceof Error&&t.t1.message.includes("skipped"))){t.next=44;break}return t.abrupt("continue",27);case 44:throw t.t1;case 45:t.next=27;break;case 47:return t.next=49,this.getConfirmedSignaturesForAddress2(e,i);case 49:return c=t.sent,t.abrupt("return",c.map((function(t){return t.signature})));case 51:case"end":return t.stop()}}),t,this,[[8,15],[31,38]])}))),function(t,e,n){return N.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress2",value:(A=_(O().mark((function t(e,n,r){var i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,n),t.next=3,this._rpcRequest("getConfirmedSignaturesForAddress2",i);case 3:if(o=t.sent,!("error"in(a=ao(o,Wc)))){t.next=7;break}throw new qu(a.error,"failed to get confirmed signatures for address");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return A.apply(this,arguments)})},{key:"getSignaturesForAddress",value:(M=_(O().mark((function t(e,n,r){var i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,n),t.next=3,this._rpcRequest("getSignaturesForAddress",i);case 3:if(o=t.sent,!("error"in(a=ao(o,Fc)))){t.next=7;break}throw new qu(a.error,"failed to get signatures for address");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return M.apply(this,arguments)})},{key:"getAddressLookupTable",value:(b=_(O().mark((function t(e,n){var r,i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAccountInfoAndContext(e,n);case 2:return r=t.sent,i=r.context,o=r.value,a=null,null!==o&&(a=new Xu({key:e,state:Xu.deserialize(o.data)})),t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return b.apply(this,arguments)})},{key:"getNonceAndContext",value:(w=_(O().mark((function t(e,n){var r,i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAccountInfoAndContext(e,n);case 2:return r=t.sent,i=r.context,o=r.value,a=null,null!==o&&(a=Du.fromAccountData(o.data)),t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return w.apply(this,arguments)})},{key:"getNonce",value:(v=_(O().mark((function t(e,n){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getNonceAndContext(e,n).then((function(t){return t.value})).catch((function(t){throw new Error("failed to get nonce for account "+e.toBase58()+": "+t)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return v.apply(this,arguments)})},{key:"requestAirdrop",value:(g=_(O().mark((function t(e,n){var r,i;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("requestAirdrop",[e.toBase58(),n]);case 2:if(r=t.sent,!("error"in(i=ao(r,Pl)))){t.next=6;break}throw new qu(i.error,"airdrop to ".concat(e.toBase58()," failed"));case 6:return t.abrupt("return",i.result);case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return g.apply(this,arguments)})},{key:"_blockhashWithExpiryBlockHeight",value:(m=_(O().mark((function t(e){var n,r;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=10;break}case 1:if(!this._pollingBlockhash){t.next=6;break}return t.next=4,ku(100);case 4:t.next=1;break;case 6:if(n=Date.now()-this._blockhashInfo.lastFetch,r=n>=3e4,null===this._blockhashInfo.latestBlockhash||r){t.next=10;break}return t.abrupt("return",this._blockhashInfo.latestBlockhash);case 10:return t.next=12,this._pollNewBlockhash();case 12:return t.abrupt("return",t.sent);case 13:case"end":return t.stop()}}),t,this)}))),function(t){return m.apply(this,arguments)})},{key:"_pollNewBlockhash",value:(y=_(O().mark((function t(){var e,n,r,i,o;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._pollingBlockhash=!0,t.prev=1,e=Date.now(),n=this._blockhashInfo.latestBlockhash,r=n?n.blockhash:null,i=0;case 6:if(!(i<50)){t.next=18;break}return t.next=9,this.getLatestBlockhash("finalized");case 9:if(o=t.sent,r===o.blockhash){t.next=13;break}return this._blockhashInfo={latestBlockhash:o,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t.abrupt("return",o);case 13:return t.next=15,ku(200);case 15:i++,t.next=6;break;case 18:throw new Error("Unable to obtain a new blockhash after ".concat(Date.now()-e,"ms"));case 19:return t.prev=19,this._pollingBlockhash=!1,t.finish(19);case 22:case"end":return t.stop()}}),t,this,[[1,,19,22]])}))),function(){return y.apply(this,arguments)})},{key:"getStakeMinimumDelegation",value:(p=_(O().mark((function t(e){var n,r,i,o,a,s;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=rc(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,"base64",i),t.next=4,this._rpcRequest("getStakeMinimumDelegation",o);case 4:if(a=t.sent,!("error"in(s=ao(a,sc(mo()))))){t.next=8;break}throw new qu(s.error,"failed to get stake minimum delegation");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return p.apply(this,arguments)})},{key:"simulateTransaction",value:(f=_(O().mark((function t(e,n,r){var i,o,a,s,u,c,l,h,d,f,p,y,m,g,v,w,b,M,A,N,I,E,x,k,T;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("message"in e)){t.next=17;break}if(i=e.serialize(),o=It.from(i).toString("base64"),!Array.isArray(n)&&void 0===r){t.next=6;break}throw new Error("Invalid arguments");case 6:return(a=n||{}).encoding="base64","commitment"in a||(a.commitment=this.commitment),s=[o,a],t.next=12,this._rpcRequest("simulateTransaction",s);case 12:if(u=t.sent,!("error"in(c=ao(u,Mc)))){t.next=16;break}throw new Error("failed to simulate transaction: "+c.error.message);case 16:return t.abrupt("return",c.result);case 17:if(e instanceof fu?(h=e,(l=new fu).feePayer=h.feePayer,l.instructions=e.instructions,l.nonceInfo=h.nonceInfo,l.signatures=h.signatures):(l=fu.populate(e))._message=l._json=void 0,void 0===n||Array.isArray(n)){t.next=20;break}throw new Error("Invalid arguments");case 20:if(d=n,!l.nonceInfo||!d){t.next=25;break}(f=l).sign.apply(f,et(d)),t.next=45;break;case 25:p=this._disableBlockhashCaching;case 26:return t.next=28,this._blockhashWithExpiryBlockHeight(p);case 28:if(m=t.sent,l.lastValidBlockHeight=m.lastValidBlockHeight,l.recentBlockhash=m.blockhash,d){t.next=33;break}return t.abrupt("break",45);case 33:if((y=l).sign.apply(y,et(d)),l.signature){t.next=36;break}throw new Error("!signature");case 36:if(g=l.signature.toString("base64"),this._blockhashInfo.simulatedSignatures.includes(g)||this._blockhashInfo.transactionSignatures.includes(g)){t.next=42;break}return this._blockhashInfo.simulatedSignatures.push(g),t.abrupt("break",45);case 42:p=!0;case 43:t.next=26;break;case 45:return v=l._compile(),w=v.serialize(),b=l._serialize(w),M=b.toString("base64"),A={encoding:"base64",commitment:this.commitment},r&&(N=(Array.isArray(r)?r:v.nonProgramIds()).map((function(t){return t.toBase58()})),A.accounts={encoding:"base64",addresses:N}),d&&(A.sigVerify=!0),I=[M,A],t.next=55,this._rpcRequest("simulateTransaction",I);case 55:if(E=t.sent,!("error"in(x=ao(E,Mc)))){t.next=60;break}throw"data"in x.error&&(k=x.error.data.logs)&&Array.isArray(k)&&(T="\n "+k.join("\n "),console.error(x.error.message,T)),new Gu("failed to simulate transaction: "+x.error.message,k);case 60:return t.abrupt("return",x.result);case 61:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return f.apply(this,arguments)})},{key:"sendTransaction",value:(d=_(O().mark((function t(e,n,r){var i,o,a,s,u,c;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("version"in e)){t.next=7;break}if(!n||!Array.isArray(n)){t.next=3;break}throw new Error("Invalid arguments");case 3:return i=e.serialize(),t.next=6,this.sendRawTransaction(i,n);case 6:return t.abrupt("return",t.sent);case 7:if(void 0!==n&&Array.isArray(n)){t.next=9;break}throw new Error("Invalid arguments");case 9:if(o=n,!e.nonceInfo){t.next=14;break}e.sign.apply(e,et(o)),t.next=32;break;case 14:a=this._disableBlockhashCaching;case 15:return t.next=17,this._blockhashWithExpiryBlockHeight(a);case 17:if(s=t.sent,e.lastValidBlockHeight=s.lastValidBlockHeight,e.recentBlockhash=s.blockhash,e.sign.apply(e,et(o)),e.signature){t.next=23;break}throw new Error("!signature");case 23:if(u=e.signature.toString("base64"),this._blockhashInfo.transactionSignatures.includes(u)){t.next=29;break}return this._blockhashInfo.transactionSignatures.push(u),t.abrupt("break",32);case 29:a=!0;case 30:t.next=15;break;case 32:return c=e.serialize(),t.next=35,this.sendRawTransaction(c,r);case 35:return t.abrupt("return",t.sent);case 36:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return d.apply(this,arguments)})},{key:"sendRawTransaction",value:(h=_(O().mark((function t(e,n){var r,i;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_s(e).toString("base64"),t.next=3,this.sendEncodedTransaction(r,n);case 3:return i=t.sent,t.abrupt("return",i);case 5:case"end":return t.stop()}}),t,this)}))),function(t,e){return h.apply(this,arguments)})},{key:"sendEncodedTransaction",value:(l=_(O().mark((function t(e,n){var r,i,o,a,s,u,c;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={encoding:"base64"},i=n&&n.skipPreflight,o=n&&n.preflightCommitment||this.commitment,n&&null!=n.maxRetries&&(r.maxRetries=n.maxRetries),n&&null!=n.minContextSlot&&(r.minContextSlot=n.minContextSlot),i&&(r.skipPreflight=i),o&&(r.preflightCommitment=o),a=[e,r],t.next=10,this._rpcRequest("sendTransaction",a);case 10:if(s=t.sent,!("error"in(u=ao(s,_l)))){t.next=15;break}throw"data"in u.error&&(c=u.error.data.logs),new Gu("failed to send transaction: "+u.error.message,c);case 15:return t.abrupt("return",u.result);case 16:case"end":return t.stop()}}),t,this)}))),function(t,e){return l.apply(this,arguments)})},{key:"_wsOnOpen",value:function(){var t=this;this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((function(){_(O().mark((function e(){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t._rpcWebSocket.notify("ping");case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})))()}),5e3),this._updateSubscriptions()}},{key:"_wsOnError",value:function(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}},{key:"_wsOnClose",value:function(t){var e=this;this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((function(t){var n=tt(t,2),r=n[0],i=n[1];e._setSubscription(r,D(D({},i),{},{state:"pending"}))}))):this._updateSubscriptions()}},{key:"_setSubscription",value:function(t,e){var n,r=null===(n=this._subscriptionsByHash[t])||void 0===n?void 0:n.state;if(this._subscriptionsByHash[t]=e,r!==e.state){var i=this._subscriptionStateChangeCallbacksByHash[t];i&&i.forEach((function(t){try{t(e.state)}catch(t){}}))}}},{key:"_onSubscriptionStateChange",value:function(t,e){var n,r=this,i=this._subscriptionHashByClientSubscriptionId[t];if(null==i)return function(){};var o=(n=this._subscriptionStateChangeCallbacksByHash)[i]||(n[i]=new Set);return o.add(e),function(){o.delete(e),0===o.size&&delete r._subscriptionStateChangeCallbacksByHash[i]}}},{key:"_updateSubscriptions",value:(c=_(O().mark((function t(){var e,n,r=this;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==Object.keys(this._subscriptionsByHash).length){t.next=3;break}return this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((function(){r._rpcWebSocketIdleTimeout=null;try{r._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log("Error when closing socket connection: ".concat(t.message))}}),500)),t.abrupt("return");case 3:if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),this._rpcWebSocketConnected){t.next=7;break}return this._rpcWebSocket.connect(),t.abrupt("return");case 7:return e=this._rpcWebSocketGeneration,n=function(){return e===r._rpcWebSocketGeneration},t.next=11,Promise.all(Object.keys(this._subscriptionsByHash).map(function(){var t=_(O().mark((function t(e){var i;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(i=r._subscriptionsByHash[e])){t.next=3;break}return t.abrupt("return");case 3:t.t0=i.state,t.next="pending"===t.t0||"unsubscribed"===t.t0?6:"subscribed"===t.t0?15:19;break;case 6:if(0!==i.callbacks.size){t.next=12;break}return delete r._subscriptionsByHash[e],"unsubscribed"===i.state&&delete r._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],t.next=11,r._updateSubscriptions();case 11:return t.abrupt("return");case 12:return t.next=14,_(O().mark((function t(){var o,a,s;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=i.args,a=i.method,t.prev=1,r._setSubscription(e,D(D({},i),{},{state:"subscribing"})),t.next=5,r._rpcWebSocket.call(a,o);case 5:return s=t.sent,r._setSubscription(e,D(D({},i),{},{serverSubscriptionId:s,state:"subscribed"})),r._subscriptionCallbacksByServerSubscriptionId[s]=i.callbacks,t.next=10,r._updateSubscriptions();case 10:t.next=20;break;case 12:if(t.prev=12,t.t0=t.catch(1),t.t0 instanceof Error&&console.error("".concat(a," error for argument"),o,t.t0.message),n()){t.next=17;break}return t.abrupt("return");case 17:return r._setSubscription(e,D(D({},i),{},{state:"pending"})),t.next=20,r._updateSubscriptions();case 20:case"end":return t.stop()}}),t,null,[[1,12]])})))();case 14:case 18:return t.abrupt("break",19);case 15:if(0!==i.callbacks.size){t.next=18;break}return t.next=18,_(O().mark((function t(){var o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=i.serverSubscriptionId,a=i.unsubscribeMethod,!r._subscriptionsAutoDisposedByRpc.has(o)){t.next=5;break}r._subscriptionsAutoDisposedByRpc.delete(o),t.next=21;break;case 5:return r._setSubscription(e,D(D({},i),{},{state:"unsubscribing"})),r._setSubscription(e,D(D({},i),{},{state:"unsubscribing"})),t.prev=7,t.next=10,r._rpcWebSocket.call(a,[o]);case 10:t.next=21;break;case 12:if(t.prev=12,t.t0=t.catch(7),t.t0 instanceof Error&&console.error("".concat(a," error:"),t.t0.message),n()){t.next=17;break}return t.abrupt("return");case 17:return r._setSubscription(e,D(D({},i),{},{state:"subscribed"})),t.next=20,r._updateSubscriptions();case 20:return t.abrupt("return");case 21:return r._setSubscription(e,D(D({},i),{},{state:"unsubscribed"})),t.next=24,r._updateSubscriptions();case 24:case"end":return t.stop()}}),t,null,[[7,12]])})))();case 19:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 11:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"_handleServerNotification",value:function(t,e){var n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((function(t){try{t.apply(void 0,et(e))}catch(t){console.error(t)}}))}},{key:"_wsOnAccountNotification",value:function(t){var e=ao(t,Vc),n=e.result,r=e.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_makeSubscription",value:function(t,e){var n=this,r=this._nextClientSubscriptionId++,i=Fu([t.method,e],!0),o=this._subscriptionsByHash[i];return void 0===o?this._subscriptionsByHash[i]=D(D({},t),{},{args:e,callbacks:new Set([t.callback]),state:"pending"}):o.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=_(O().mark((function e(){var o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return delete n._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete n._subscriptionHashByClientSubscriptionId[r],ou(void 0!==(o=n._subscriptionsByHash[i]),"Could not find a `Subscription` when tearing down client subscription #".concat(r)),o.callbacks.delete(t.callback),e.next=7,n._updateSubscriptions();case 7:case"end":return e.stop()}}),e)}))),this._updateSubscriptions(),r}},{key:"onAccountChange",value:function(t,e,n){var r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}},{key:"removeAccountChangeListener",value:(u=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"account change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"_wsOnProgramAccountNotification",value:function(t){var e=ao(t,Gc),n=e.result,r=e.subscription;this._handleServerNotification(r,[{accountId:n.value.pubkey,accountInfo:n.value.account},n.context])}},{key:"onProgramAccountChange",value:function(t,e,n,r){var i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}},{key:"removeProgramAccountChangeListener",value:(s=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"program account change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"onLogs",value:function(t,e,n){var r=this._buildArgs(["object"===z(t)?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}},{key:"removeOnLogsListener",value:(a=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"logs");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"_wsOnLogsNotification",value:function(t){var e=ao(t,Rl),n=e.result,r=e.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_wsOnSlotNotification",value:function(t){var e=ao(t,Zc),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotChange",value:function(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}},{key:"removeSlotChangeListener",value:(o=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"slot change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"_wsOnSlotUpdatesNotification",value:function(t){var e=ao(t,Xc),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotUpdate",value:function(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}},{key:"removeSlotUpdateListener",value:(i=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"slot update");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"_unsubscribeClientSubscription",value:(r=_(O().mark((function t(e,n){var r;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r=this._subscriptionDisposeFunctionsByClientSubscriptionId[e])){t.next=6;break}return t.next=4,r();case 4:t.next=7;break;case 6:console.warn("Ignored unsubscribe request because an active subscription with id "+"`".concat(e,"` for '").concat(n,"' events ")+"could not be found.");case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"_buildArgs",value:function(t,e,n,r){var i=e||this._commitment;if(i||n||r){var o={};n&&(o.encoding=n),i&&(o.commitment=i),r&&(o=Object.assign(o,r)),t.push(o)}return t}},{key:"_buildArgsAtLeastConfirmed",value:function(t,e,n,r){var i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}},{key:"_wsOnSignatureNotification",value:function(t){var e=ao(t,Kc),n=e.result,r=e.subscription;"receivedSignature"!==n.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===n.value?[{type:"received"},n.context]:[{type:"status",result:n.value},n.context])}},{key:"onSignature",value:function(t,e,n){var r=this,i=this._buildArgs([t],n||this._commitment||"finalized"),o=this._makeSubscription({callback:function(t,n){if("status"===t.type){e(t.result,n);try{r.removeSignatureListener(o)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return o}},{key:"onSignatureWithOptions",value:function(t,e,n){var r=this,i=D(D({},n),{},{commitment:n&&n.commitment||this._commitment||"finalized"}),o=i.commitment,a=q(i,Ls),s=this._buildArgs([t],o,void 0,a),u=this._makeSubscription({callback:function(t,n){e(t,n);try{r.removeSignatureListener(u)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return u}},{key:"removeSignatureListener",value:(n=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"signature result");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"_wsOnRootNotification",value:function(t){var e=ao(t,$c),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onRootChange",value:function(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}},{key:"removeRootChangeListener",value:(e=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"root change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),t}(),Yl=function(){function t(e){B(this,t),this._keypair=void 0,this._keypair=null!=e?e:js()}return U(t,[{key:"publicKey",get:function(){return new Ws(this._keypair.publicKey)}},{key:"secretKey",get:function(){return new Uint8Array(this._keypair.secretKey)}}],[{key:"generate",value:function(){return new t(js())}},{key:"fromSecretKey",value:function(e,n){if(64!==e.byteLength)throw new Error("bad secret key size");var r=e.slice(32,64);if(!n||!n.skipValidation)for(var i=e.slice(0,32),o=Cs(i),a=0;a<32;a++)if(r[a]!==o[a])throw new Error("provided secretKey is invalid");return new t({publicKey:r,secretKey:e})}},{key:"fromSeed",value:function(e){var n=Cs(e),r=new Uint8Array(64);return r.set(e),r.set(n,32),new t({publicKey:n,secretKey:r})}}]),t}(),Wl=Object.freeze({CreateLookupTable:{index:0,layout:Qi([Bi("instruction"),Ou("recentSlot"),Pi("bumpSeed")])},FreezeLookupTable:{index:1,layout:Qi([Bi("instruction")])},ExtendLookupTable:{index:2,layout:Qi([Bi("instruction"),Ou(),Yi($s(),zi(Bi(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Qi([Bi("instruction")])},CloseLookupTable:{index:4,layout:Qi([Bi("instruction")])}}),Fl=function(){function t(){B(this,t)}return U(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=Bi("instruction").decode(t.data),r=0,i=Object.entries(Wl);r2?t.keys[2].pubkey:void 0,addresses:e.map((function(t){return new Ws(t)}))}}},{key:"decodeCloseLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}},{key:"decodeFreezeLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}},{key:"decodeDeactivateLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(Vl.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}},{key:"checkKeysLength",value:function(t,e){if(t.length3&&(i.custodianPubkey=t.keys[3].pubkey),i}},{key:"decodeAuthorizeWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=Lu(oh.AuthorizeWithSeed,t.data),n=e.newAuthorized,r=e.stakeAuthorizationType,i=e.authoritySeed,o=e.authorityOwner,a={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:i,authorityOwner:new Ws(o),newAuthorizedPubkey:new Ws(n),stakeAuthorizationType:{index:r}};return t.keys.length>3&&(a.custodianPubkey=t.keys[3].pubkey),a}},{key:"decodeSplit",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=Lu(oh.Split,t.data).lamports;return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}},{key:"decodeMerge",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Lu(oh.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}},{key:"decodeWithdraw",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);var e=Lu(oh.Withdraw,t.data).lamports,n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}},{key:"decodeDeactivate",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Lu(oh.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(sh.programId))throw new Error("invalid instruction; programId is not StakeProgram")}},{key:"checkKeyLength",value:function(t,e){if(t.length0&&void 0!==arguments[0]?arguments[0]:"authorized";return Qi([$s("staker"),$s("withdrawer")],t)}(),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return Qi([Ui("unixTimestamp"),Ui("epoch"),$s("custodian")],t)}()])},Authorize:{index:1,layout:Qi([Bi("instruction"),$s("newAuthorized"),Bi("stakeAuthorizationType")])},Delegate:{index:2,layout:Qi([Bi("instruction")])},Split:{index:3,layout:Qi([Bi("instruction"),Ui("lamports")])},Withdraw:{index:4,layout:Qi([Bi("instruction"),Ui("lamports")])},Deactivate:{index:5,layout:Qi([Bi("instruction")])},Merge:{index:7,layout:Qi([Bi("instruction")])},AuthorizeWithSeed:{index:8,layout:Qi([Bi("instruction"),$s("newAuthorized"),Bi("stakeAuthorizationType"),eu("authoritySeed"),$s("authorityOwner")])}}),ah=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),sh=function(){function t(){B(this,t)}return U(t,null,[{key:"initialize",value:function(t){var e=t.stakePubkey,n=t.authorized,r=t.lockup||rh.default,i=Tu(oh.Initialize,{authorized:{staker:_s(n.staker.toBuffer()),withdrawer:_s(n.withdrawer.toBuffer())},lockup:{unixTimestamp:r.unixTimestamp,epoch:r.epoch,custodian:_s(r.custodian.toBuffer())}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:bu,isSigner:!1,isWritable:!1}],programId:this.programId,data:i};return new du(o)}},{key:"createAccountWithSeed",value:function(t){var e=new fu;e.add(_u.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));var n=t.stakePubkey,r=t.authorized,i=t.lockup;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"createAccount",value:function(t){var e=new fu;e.add(_u.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));var n=t.stakePubkey,r=t.authorized,i=t.lockup;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"delegate",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.votePubkey,i=Tu(oh.Delegate);return(new fu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:Iu,isSigner:!1,isWritable:!1},{pubkey:eh,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"authorize",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.newAuthorizedPubkey,i=t.stakeAuthorizationType,o=t.custodianPubkey,a=Tu(oh.Authorize,{newAuthorized:_s(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:mu,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new fu).add({keys:s,programId:this.programId,data:a})}},{key:"authorizeWithSeed",value:function(t){var e=t.stakePubkey,n=t.authorityBase,r=t.authoritySeed,i=t.authorityOwner,o=t.newAuthorizedPubkey,a=t.stakeAuthorizationType,s=t.custodianPubkey,u=Tu(oh.AuthorizeWithSeed,{newAuthorized:_s(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:_s(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:mu,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new fu).add({keys:c,programId:this.programId,data:u})}},{key:"splitInstruction",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.splitStakePubkey,i=t.lamports,o=Tu(oh.Split,{lamports:i});return new du({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}},{key:"split",value:function(t){var e=new fu;return e.add(_u.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}},{key:"splitWithSeed",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.splitStakePubkey,i=t.basePubkey,o=t.seed,a=t.lamports,s=new fu;return s.add(_u.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}},{key:"merge",value:function(t){var e=t.stakePubkey,n=t.sourceStakePubKey,r=t.authorizedPubkey,i=Tu(oh.Merge);return(new fu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:Iu,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"withdraw",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.toPubkey,i=t.lamports,o=t.custodianPubkey,a=Tu(oh.Withdraw,{lamports:i}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:Iu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new fu).add({keys:s,programId:this.programId,data:a})}},{key:"deactivate",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=Tu(oh.Deactivate);return(new fu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}]),t}();sh.programId=new Ws("Stake11111111111111111111111111111111111111"),sh.space=200;var uh=U((function t(e,n,r,i){B(this,t),this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=e,this.authorizedVoter=n,this.authorizedWithdrawer=r,this.commission=i})),ch=function(){function t(){B(this,t)}return U(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=Bi("instruction").decode(t.data),r=0,i=Object.entries(lh);r0&&void 0!==arguments[0]?arguments[0]:"voteInit";return Qi([$s("nodePubkey"),$s("authorizedVoter"),$s("authorizedWithdrawer"),Pi("commission")],t)}()])},Authorize:{index:1,layout:Qi([Bi("instruction"),$s("newAuthorized"),Bi("voteAuthorizationType")])},Withdraw:{index:3,layout:Qi([Bi("instruction"),Ui("lamports")])},AuthorizeWithSeed:{index:10,layout:Qi([Bi("instruction"),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return Qi([Bi("voteAuthorizationType"),$s("currentAuthorityDerivedKeyOwnerPubkey"),eu("currentAuthorityDerivedKeySeed"),$s("newAuthorized")],t)}()])}}),hh=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),dh=function(){function t(){B(this,t)}return U(t,null,[{key:"initializeAccount",value:function(t){var e=t.votePubkey,n=t.nodePubkey,r=t.voteInit,i=Tu(lh.InitializeAccount,{voteInit:{nodePubkey:_s(r.nodePubkey.toBuffer()),authorizedVoter:_s(r.authorizedVoter.toBuffer()),authorizedWithdrawer:_s(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:bu,isSigner:!1,isWritable:!1},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new du(o)}},{key:"createAccount",value:function(t){var e=new fu;return e.add(_u.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}},{key:"authorize",value:function(t){var e=t.votePubkey,n=t.authorizedPubkey,r=t.newAuthorizedPubkey,i=t.voteAuthorizationType,o=Tu(lh.Authorize,{newAuthorized:_s(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new fu).add({keys:a,programId:this.programId,data:o})}},{key:"authorizeWithSeed",value:function(t){var e=t.currentAuthorityDerivedKeyBasePubkey,n=t.currentAuthorityDerivedKeyOwnerPubkey,r=t.currentAuthorityDerivedKeySeed,i=t.newAuthorizedPubkey,o=t.voteAuthorizationType,a=t.votePubkey,s=Tu(lh.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:_s(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:_s(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new fu).add({keys:u,programId:this.programId,data:s})}},{key:"withdraw",value:function(t){var e=t.votePubkey,n=t.authorizedWithdrawerPubkey,r=t.lamports,i=t.toPubkey,o=Tu(lh.Withdraw,{lamports:r}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new fu).add({keys:a,programId:this.programId,data:o})}},{key:"safeWithdraw",value:function(e,n,r){if(e.lamports>n-r)throw new Error("Withdraw will leave vote account with insuffcient funds.");return t.withdraw(e)}}]),t}();dh.programId=new Ws("Vote111111111111111111111111111111111111111"),dh.space=3731;var fh=new Ws("Va1idator1nfo111111111111111111111111111111"),ph=Mo({name:wo(),website:go(wo()),details:go(wo()),keybaseUsername:go(wo())}),yh=function(){function t(e,n){B(this,t),this.key=void 0,this.info=void 0,this.key=e,this.info=n}return U(t,null,[{key:"fromConfigData",value:function(e){var n=et(e);if(2!==ru(n))return null;for(var r=[],i=0;i<2;i++){var o=new Ws(n.slice(0,Qs)),a=1===(n=n.slice(Qs)).slice(0,1)[0];n=n.slice(1),r.push({publicKey:o,isSigner:a})}if(r[0].publicKey.equals(fh)&&r[1].isSigner){var s=eu().decode(It.from(n)),u=JSON.parse(s);return oo(u,ph),new t(r[1].publicKey,u)}return null}}]),t}(),mh=new Ws("Vote111111111111111111111111111111111111111"),gh=Qi([$s("nodePubkey"),$s("authorizedWithdrawer"),Pi("commission"),Ri(),Yi(Qi([Ri("slot"),Bi("confirmationCount")]),zi(Bi(),-8),"votes"),Pi("rootSlotValid"),Ri("rootSlot"),Ri(),Yi(Qi([Ri("epoch"),$s("authorizedVoter")]),zi(Bi(),-8),"authorizedVoters"),Qi([Yi(Qi([$s("authorizedPubkey"),Ri("epochOfLastAuthorizedSwitch"),Ri("targetEpoch")]),32,"buf"),Ri("idx"),Pi("isEmpty")],"priorVoters"),Ri(),Yi(Qi([Ri("epoch"),Ri("credits"),Ri("prevCredits")]),zi(Bi(),-8),"epochCredits"),Qi([Ri("slot"),Ri("timestamp")],"lastTimestamp")]),vh=function(){function t(e){B(this,t),this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}return U(t,null,[{key:"fromAccountData",value:function(e){var n=gh.decode(_s(e),4),r=n.rootSlot;return n.rootSlotValid||(r=null),new t({nodePubkey:new Ws(n.nodePubkey),authorizedWithdrawer:new Ws(n.authorizedWithdrawer),commission:n.commission,votes:n.votes,rootSlot:r,authorizedVoters:n.authorizedVoters.map(wh),priorVoters:Mh(n.priorVoters),epochCredits:n.epochCredits,lastTimestamp:n.lastTimestamp})}}]),t}();function wh(t){var e=t.authorizedVoter;return{epoch:t.epoch,authorizedVoter:new Ws(e)}}function bh(t){var e=t.authorizedPubkey,n=t.epochOfLastAuthorizedSwitch,r=t.targetEpoch;return{authorizedPubkey:new Ws(e),epochOfLastAuthorizedSwitch:n,targetEpoch:r}}function Mh(t){var e=t.buf,n=t.idx;return t.isEmpty?[]:[].concat(et(e.slice(n+1).map(bh)),et(e.slice(0,n).map(bh)))}var Ah={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function Nh(){return(Nh=_(O().mark((function t(e,n,r,i){var o,a,s,u,c,l,h;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r&&Object.prototype.hasOwnProperty.call(r,"lastValidBlockHeight")||r&&Object.prototype.hasOwnProperty.call(r,"nonceValue")?(o=r,a=i):a=r,s=a&&{skipPreflight:a.skipPreflight,preflightCommitment:a.preflightCommitment||a.commitment,minContextSlot:a.minContextSlot},t.next=4,e.sendRawTransaction(n,s);case 4:return u=t.sent,c=a&&a.commitment,l=o?e.confirmTransaction(o,c):e.confirmTransaction(u,c),t.next=9,l;case 9:if(!(h=t.sent.value).err){t.next=12;break}throw new Error("Raw transaction ".concat(u," failed (").concat(JSON.stringify(h),")"));case 12:return t.abrupt("return",u);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Ih=j(Object.freeze({__proto__:null,Account:Fs,AddressLookupTableAccount:Xu,AddressLookupTableInstruction:Fl,AddressLookupTableProgram:Vl,Authorized:nh,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:Vs,BPF_LOADER_PROGRAM_ID:Ru,BpfLoader:Uu,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:Gl,ComputeBudgetInstruction:Hl,ComputeBudgetProgram:ql,Connection:Ql,Ed25519Program:Jl,Enum:Rs,EpochSchedule:Hu,FeeCalculatorLayout:Su,Keypair:Yl,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:Wl,Loader:Bu,Lockup:rh,MAX_SEED_LENGTH:32,Message:su,MessageAccountKeys:Ks,MessageV0:uu,NONCE_ACCOUNT_LENGTH:Cu,NonceAccount:Du,PACKET_DATA_SIZE:Hs,PUBLIC_KEY_LENGTH:Qs,PublicKey:Ws,SIGNATURE_LENGTH_IN_BYTES:qs,SOLANA_SCHEMA:Us,STAKE_CONFIG_ID:eh,STAKE_INSTRUCTION_LAYOUTS:oh,SYSTEM_INSTRUCTION_LAYOUTS:Pu,SYSVAR_CLOCK_PUBKEY:mu,SYSVAR_EPOCH_SCHEDULE_PUBKEY:gu,SYSVAR_INSTRUCTIONS_PUBKEY:vu,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:wu,SYSVAR_RENT_PUBKEY:bu,SYSVAR_REWARDS_PUBKEY:Mu,SYSVAR_SLOT_HASHES_PUBKEY:Au,SYSVAR_SLOT_HISTORY_PUBKEY:Nu,SYSVAR_STAKE_HISTORY_PUBKEY:Iu,Secp256k1Program:th,SendTransactionError:Gu,SolanaJSONRPCError:qu,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:ah,StakeInstruction:ih,StakeProgram:sh,Struct:Bs,SystemInstruction:zu,SystemProgram:_u,Transaction:fu,TransactionExpiredBlockheightExceededError:Zs,TransactionExpiredNonceInvalidError:Xs,TransactionExpiredTimeoutError:Js,TransactionInstruction:du,TransactionMessage:pu,TransactionStatus:lu,VALIDATOR_INFO_KEY:fh,VERSION_PREFIX_MASK:Gs,VOTE_PROGRAM_ID:mh,ValidatorInfo:yh,VersionedMessage:cu,VersionedTransaction:yu,VoteAccount:vh,VoteAuthorizationLayout:hh,VoteInit:uh,VoteInstruction:ch,VoteProgram:dh,clusterApiUrl:function(t,e){var n=!1===e?"http":"https";if(!t)return Ah[n].devnet;var r=Ah[n][t];if(!r)throw new Error("Unknown ".concat(n," cluster: ").concat(t));return r},sendAndConfirmRawTransaction:function(t,e,n,r){return Nh.apply(this,arguments)},sendAndConfirmTransaction:Eu})),Eh={};Object.defineProperty(Eh,"__esModule",{value:!0});var xh,kh={ERROR_ASSOCIATION_PORT_OUT_OF_RANGE:"ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",ERROR_FORBIDDEN_WALLET_BASE_URL:"ERROR_FORBIDDEN_WALLET_BASE_URL",ERROR_SECURE_CONTEXT_REQUIRED:"ERROR_SECURE_CONTEXT_REQUIRED",ERROR_SESSION_CLOSED:"ERROR_SESSION_CLOSED",ERROR_SESSION_TIMEOUT:"ERROR_SESSION_TIMEOUT",ERROR_WALLET_NOT_FOUND:"ERROR_WALLET_NOT_FOUND"},Th=function(t){Y(n,t);var e=X(n);function n(){var t;B(this,n);for(var r=arguments.length,i=new Array(r),o=0;o=4294967296)throw new Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");var e=new ArrayBuffer(4);return new DataView(e).setUint32(0,t,!1),new Uint8Array(e)}function Dh(){return Sh(this,void 0,void 0,O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}function Oh(){return Sh(this,void 0,void 0,O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}function zh(t,e){return Sh(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=JSON.stringify(t),i=Ch(t.id),o=new Uint8Array(12),crypto.getRandomValues(o),n.next=6,crypto.subtle.encrypt(_h(i,o),e,(new TextEncoder).encode(r));case 6:return a=n.sent,(s=new Uint8Array(i.byteLength+o.byteLength+a.byteLength)).set(new Uint8Array(i),0),s.set(new Uint8Array(o),i.byteLength),s.set(new Uint8Array(a),i.byteLength+o.byteLength),n.abrupt("return",s);case 12:case"end":return n.stop()}}),n)})))}function Ph(t,e){return Sh(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s,u;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t.slice(0,4),i=t.slice(4,16),o=t.slice(16),n.next=5,crypto.subtle.decrypt(_h(r,i),e,o);case 5:if(a=n.sent,s=(void 0===xh&&(xh=new TextDecoder("utf-8")),xh).decode(a),u=JSON.parse(s),!Object.hasOwnProperty.call(u,"error")){n.next=10;break}throw new Lh(u.id,u.error.code,u.error.message);case 10:return n.abrupt("return",u);case 11:case"end":return n.stop()}}),n)})))}function _h(t,e){return{additionalData:t,iv:e,name:"AES-GCM",tagLength:128}}function Bh(t,e,n){return Sh(this,void 0,void 0,O().mark((function r(){var i,o,a,s,u,c,l;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Promise.all([crypto.subtle.exportKey("raw",e),crypto.subtle.importKey("raw",t,{name:"ECDH",namedCurve:"P-256"},!1,[])]);case 2:return i=r.sent,o=tt(i,2),a=o[0],s=o[1],r.next=8,crypto.subtle.deriveBits({name:"ECDH",public:s},n,256);case 8:return u=r.sent,r.next=11,crypto.subtle.importKey("raw",u,"HKDF",!1,["deriveKey"]);case 11:return c=r.sent,r.next=14,crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(a),info:new Uint8Array},c,{name:"AES-GCM",length:128},!1,["encrypt","decrypt"]);case 14:return l=r.sent,r.abrupt("return",l);case 16:case"end":return r.stop()}}),r)})))}function Rh(t){if(t<49152||t>65535)throw new Th(kh.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE,"Association port number must be between 49152 and 65535. ".concat(t," given."),{port:t});return t}function Uh(t){for(var e="",n=new Uint8Array(t),r=n.byteLength,i=0;i1?t.shift():t[0]}}(),u=1,c=0,l={__type:"disconnected"},n.abrupt("return",new Promise((function(e,n){var d,f,p,y={},m=function t(){return Sh(h,void 0,void 0,O().mark((function e(){var n,r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("connecting"===l.__type){e.next=3;break}return console.warn("Expected adapter state to be `connecting` at the moment the websocket opens. "+"Got `".concat(l.__type,"`.")),e.abrupt("return");case 3:return n=l.associationKeypair,d.removeEventListener("open",t),e.next=7,Oh();case 7:return r=e.sent,e.t0=d,e.next=11,jh(r.publicKey,n.privateKey);case 11:e.t1=e.sent,e.t0.send.call(e.t0,e.t1),l={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:r.privateKey};case 14:case"end":return e.stop()}}),e)})))},g=function(t){t.wasClean?l={__type:"disconnected"}:n(new Th(kh.ERROR_SESSION_CLOSED,"The wallet session dropped unexpectedly (".concat(t.code,": ").concat(t.reason,")."),{closeEvent:t})),f()},v=function(t){return Sh(h,void 0,void 0,O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(f(),!(Date.now()-a>=3e4)){t.next=5;break}n(new Th(kh.ERROR_SESSION_TIMEOUT,"Failed to connect to the wallet websocket on port ".concat(i,"."))),t.next=8;break;case 5:return t.next=7,new Promise((function(t){var e=s();p=window.setTimeout(t,e)}));case 7:b();case 8:case"end":return t.stop()}}),t)})))},w=function(r){return Sh(h,void 0,void 0,O().mark((function i(){var o,a,s,h,p,m,g,v;return O().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,r.data.arrayBuffer();case 2:o=i.sent,i.t0=l.__type,i.next="connected"===i.t0?6:"hello_req_sent"===i.t0?30:51;break;case 6:if(i.prev=6,a=o.slice(0,4),(s=new DataView(a).getUint32(0,!1))===c+1){i.next=11;break}throw new Error("Encrypted message has invalid sequence number");case 11:return c=s,i.next=14,Ph(o,l.sharedSecret);case 14:h=i.sent,p=y[h.id],delete y[h.id],p.resolve(h.result),i.next=29;break;case 20:if(i.prev=20,i.t1=i.catch(6),!(i.t1 instanceof Lh)){i.next=28;break}m=y[i.t1.jsonRpcMessageId],delete y[i.t1.jsonRpcMessageId],m.reject(i.t1),i.next=29;break;case 28:throw i.t1;case 29:return i.abrupt("break",51);case 30:return i.next=32,Bh(o,l.associationPublicKey,l.ecdhPrivateKey);case 32:return g=i.sent,l={__type:"connected",sharedSecret:g},v=new Proxy({},{get:function(t,e){if(null==t[e]){var n=e.toString().replace(/[A-Z]/g,(function(t){return"_".concat(t.toLowerCase())})).toLowerCase();t[e]=function(t){return Sh(this,void 0,void 0,O().mark((function r(){var i;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=u++,r.t0=d,r.next=4,zh({id:i,jsonrpc:"2.0",method:n,params:null!=t?t:{}},g);case 4:return r.t1=r.sent,r.t0.send.call(r.t0,r.t1),r.abrupt("return",new Promise((function(t,n){y[i]={resolve:function(r){switch(e){case"authorize":case"reauthorize":var i=r.wallet_uri_base;if(null!=i)try{qh(i)}catch(t){return void n(t)}}t(r)},reject:n}})));case 7:case"end":return r.stop()}}),r)})))}}return t[e]},defineProperty:function(){return!1},deleteProperty:function(){return!1}}),i.prev=35,i.t2=e,i.next=39,t(v);case 39:i.t3=i.sent,(0,i.t2)(i.t3),i.next=46;break;case 43:i.prev=43,i.t4=i.catch(35),n(i.t4);case 46:return i.prev=46,f(),d.close(),i.finish(46);case 50:return i.abrupt("break",51);case 51:case"end":return i.stop()}}),i,null,[[6,20],[35,43,46,50]])})))},b=function(){f&&f(),l={__type:"connecting",associationKeypair:r},void 0===a&&(a=Date.now()),(d=new WebSocket(o,["com.solana.mobilewalletadapter.v1"])).addEventListener("open",m),d.addEventListener("close",g),d.addEventListener("error",v),d.addEventListener("message",w),f=function(){window.clearTimeout(p),d.removeEventListener("open",m),d.removeEventListener("close",g),d.removeEventListener("error",v),d.removeEventListener("message",w)}};b()})));case 13:case"end":return n.stop()}}),n)})))};var Zh=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n>>0,c=new Uint8Array(o);t[n];){var l=e[t.charCodeAt(n)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,n++}for(var f=o-i;f!==o&&0===c[f];)f++;for(var p=new Uint8Array(r+(o-f)),y=r;f!==o;)p[y++]=c[f++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var u=(o-i)*c+1>>>0,l=new Uint8Array(u);i!==o;){for(var h=e[i],d=0,f=u-1;(0!==h||d>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=u-r;p!==u&&0===l[p];)p++;for(var y=s.repeat(n);pthis.span)throw new RangeError("indeterminate span");return this.span}},{key:"replicate",value:function(t){var e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}},{key:"fromArray",value:function(t){}}]),t}();function sd(t,e){return e.property?t+"["+e.property+"]":t}od.Layout=ad,od.nameWithProperty=sd,od.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof ad))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=function(){return new t},Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};var ud=function(t){Y(n,t);var e=X(n);function n(){return B(this,n),e.apply(this,arguments)}return U(n,[{key:"isCount",value:function(){throw new Error("ExternalLayout is abstract")}}]),n}(ad),cd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");return(i=e.call(this,-1,r)).elementSpan=t,i}return U(n,[{key:"isCount",value:function(){return!0}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.length-e;return Math.floor(n/this.elementSpan)}},{key:"encode",value:function(t,e,n){return 0}}]),n}(ud),ld=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;if(B(this,n),!(t instanceof ad))throw new TypeError("layout must be a Layout");if(void 0===r)r=0;else if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");return(o=e.call(this,t.span,i||t.property)).layout=t,o.offset=r,o}return U(n,[{key:"isCount",value:function(){return this.layout instanceof hd||this.layout instanceof dd}},{key:"decode",value:function(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}]),n}(ud),hd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readUIntLE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}]),n}(ad),dd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readUIntBE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}]),n}(ad),fd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readIntLE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeIntLE(t,n,this.span),this.span}}]),n}(ad),pd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readIntBE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeIntBE(t,n,this.span),this.span}}]),n}(ad),yd=Math.pow(2,32);function md(t){var e=Math.floor(t/yd);return{hi32:e,lo32:t-e*yd}}function gd(t,e){return t*yd+e}var vd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.readUInt32LE(e);return gd(t.readUInt32LE(e+4),n)}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=md(t);return e.writeUInt32LE(r.lo32,n),e.writeUInt32LE(r.hi32,n+4),8}}]),n}(ad),wd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),gd(t.readUInt32BE(e),t.readUInt32BE(e+4))}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=md(t);return e.writeUInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}]),n}(ad),bd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.readUInt32LE(e);return gd(t.readInt32LE(e+4),n)}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=md(t);return e.writeUInt32LE(r.lo32,n),e.writeInt32LE(r.hi32,n+4),8}}]),n}(ad),Md=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),gd(t.readInt32BE(e),t.readUInt32BE(e+4))}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=md(t);return e.writeInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}]),n}(ad),Ad=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,4,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readFloatLE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeFloatLE(t,n),4}}]),n}(ad),Nd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,4,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readFloatBE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeFloatBE(t,n),4}}]),n}(ad),Id=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readDoubleLE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeDoubleLE(t,n),8}}]),n}(ad),Ed=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readDoubleBE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeDoubleBE(t,n),8}}]),n}(ad),xd=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;if(B(this,n),!(t instanceof ad))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof ud&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var a=-1;return!(r instanceof ud)&&0u.span&&void 0===u.property)throw new Error("fields cannot contain unnamed variable-length layout")}}catch(t){s.e(t)}finally{s.f()}var c=-1;try{c=t.reduce((function(t,e){return t+e.getSpan()}),0)}catch(t){}return(o=e.call(this,c,r)).fields=t,o.decodePrefixes=!!i,o}return U(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0;try{n=this.fields.reduce((function(n,r){var i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n,r=this.makeDestinationObject(),i=st(this.fields);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(void 0!==o.property&&(r[o.property]=o.decode(t,e)),e+=o.getSpan(t,e),this.decodePrefixes&&t.length===e)break}}catch(t){i.e(t)}finally{i.f()}return r}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r,i=n,o=0,a=0,s=st(this.fields);try{for(s.s();!(r=s.n()).done;){var u=r.value,c=u.span;if(a=0c&&(c=u.getSpan(e,n)))}o=n,n+=c}}catch(t){s.e(t)}finally{s.f()}return o+a-i}},{key:"fromArray",value:function(t){var e,n=this.makeDestinationObject(),r=st(this.fields);try{for(r.s();!(e=r.n()).done;){var i=e.value;void 0!==i.property&&0i.span?n=-1:0<=n&&(n+=i.span)}}catch(t){r.e(t)}finally{r.f()}}}]),n}(ad),Td=function(){function t(e){B(this,t),this.property=e}return U(t,[{key:"decode",value:function(){throw new Error("UnionDiscriminator is abstract")}},{key:"encode",value:function(){throw new Error("UnionDiscriminator is abstract")}}]),t}(),Ld=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),!(t instanceof ud&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return(i=e.call(this,r||t.property||"variant")).layout=t,i}return U(n,[{key:"decode",value:function(t,e){return this.layout.decode(t,e)}},{key:"encode",value:function(t,e,n){return this.layout.encode(t,e,n)}}]),n}(Td),Sd=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;B(this,n);var a=t instanceof hd||t instanceof dd;if(a)t=new Ld(new ld(t));else if(t instanceof ud&&t.isCount())t=new Ld(t);else if(!(t instanceof Td))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===r&&(r=null),!(null===r||r instanceof ad))throw new TypeError("defaultLayout must be null or a Layout");if(null!==r){if(0>r.span)throw new Error("defaultLayout must have constant span");void 0===r.property&&(r=r.replicate("content"))}var s=-1;r&&0<=(s=r.span)&&a&&(s+=t.layout.span),(o=e.call(this,s,i)).discriminator=t,o.usesPrefixDiscriminator=a,o.defaultLayout=r,o.registry={};var u=o.defaultGetSourceVariant.bind(Z(o));return o.getSourceVariant=function(t){return u(t)},o.configGetSourceVariant=function(t){u=t.bind(this)},o}return U(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}},{key:"defaultGetSourceVariant",value:function(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;var e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(var n in this.registry){var r=this.registry[n];if(t.hasOwnProperty(r.property))return r}throw new Error("unable to infer src variant")}},{key:"decode",value:function(t,e){var n;void 0===e&&(e=0);var r=this.discriminator,i=r.decode(t,e),o=this.registry[i];if(void 0===o){var a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),(n=this.makeDestinationObject())[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+a)}else n=o.decode(t,e);return n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=this.getSourceVariant(t);if(void 0===r){var i=this.discriminator,o=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=i.layout.span),i.encode(t[i.property],e,n),a+o.encode(t[o.property],e,n+a)}return r.encode(t,e,n)}},{key:"addVariant",value:function(t,e,n){var r=new jd(this,t,e,n);return this.registry[t]=r,r}},{key:"getVariant",value:function(t,e){var n=t;return It.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}]),n}(ad),jd=function(t){Y(n,t);var e=X(n);function n(t,r,i,o){var a;if(B(this,n),!(t instanceof Sd))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof i&&void 0===o&&(o=i,i=null),i){if(!(i instanceof ad))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=i.span&&i.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof o)throw new TypeError("variant must have a String property")}var s=t.span;return 0>t.span&&0<=(s=i?i.span:0)&&t.usesPrefixDiscriminator&&(s+=t.discriminator.layout.span),(a=e.call(this,s,o)).union=t,a.variant=r,a.layout=i||null,a}return U(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}},{key:"decode",value:function(t,e){var n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");var r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);var i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}},{key:"fromArray",value:function(t){if(this.layout)return this.layout.fromArray(t)}}]),n}(ad);function Cd(t){return 0>t&&(t+=4294967296),t}var Dd=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;if(B(this,n),!(t instanceof hd||t instanceof dd))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof r&&void 0===i&&(i=r,r=void 0),4=n)throw new TypeError("bits must be positive integer");var i=8*e.span,o=e.fields.reduce((function(t,e){return t+e.bits}),0);if(n+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=n,this.valueMask=(1<>>this.start}},{key:"encode",value:function(t){if(!Number.isInteger(t)||t!==Cd(t&this.valueMask))throw new TypeError(sd("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var e=this.container._packedGetValue(),n=Cd(t<n&&(n=this.length.decode(t,e)),n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}},{key:"encode",value:function(t,e,n){var r=this.length;if(this.length instanceof ud&&(r=t.length),!It.isBuffer(t)||r!==t.length)throw new TypeError(sd("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof ud&&this.length.encode(r,e,n),r}}]),n}(ad),_d=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,-1,t)}return U(n,[{key:"getSpan",value:function(t,e){if(!It.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);for(var n=e;ne.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}]),n}(ad),Bd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),"string"==typeof t&&void 0===r&&(r=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");return(i=e.call(this,-1,r)).maxSpan=t,i}return U(n,[{key:"getSpan",value:function(t,e){if(!It.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}},{key:"decode",value:function(t,e,n){void 0===e&&(e=0);var r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}]),n}(ad),Rd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;return B(this,n),(i=e.call(this,0,r)).value=t,i}return U(n,[{key:"decode",value:function(t,e,n){return this.value}},{key:"encode",value:function(t,e,n){return 0}}]),n}(ad);od.ExternalLayout=ud,od.GreedyCount=cd,od.OffsetLayout=ld,od.UInt=hd,od.UIntBE=dd,od.Int=fd,od.IntBE=pd,od.Float=Ad,od.FloatBE=Nd,od.Double=Id,od.DoubleBE=Ed,od.Sequence=xd,od.Structure=kd,od.UnionDiscriminator=Td,od.UnionLayoutDiscriminator=Ld,od.Union=Sd,od.VariantLayout=jd,od.BitStructure=Dd,od.BitField=Od,od.Boolean=zd,od.Blob=Pd,od.CString=_d,od.UTF8=Bd,od.Constant=Rd,od.greedy=function(t,e){return new cd(t,e)},od.offset=function(t,e,n){return new ld(t,e,n)},od.u8=function(t){return new hd(1,t)},od.u16=function(t){return new hd(2,t)},od.u24=function(t){return new hd(3,t)},od.u32=function(t){return new hd(4,t)},od.u40=function(t){return new hd(5,t)},od.u48=function(t){return new hd(6,t)},od.nu64=function(t){return new vd(t)},od.u16be=function(t){return new dd(2,t)},od.u24be=function(t){return new dd(3,t)},od.u32be=function(t){return new dd(4,t)},od.u40be=function(t){return new dd(5,t)},od.u48be=function(t){return new dd(6,t)},od.nu64be=function(t){return new wd(t)},od.s8=function(t){return new fd(1,t)},od.s16=function(t){return new fd(2,t)},od.s24=function(t){return new fd(3,t)},od.s32=function(t){return new fd(4,t)},od.s40=function(t){return new fd(5,t)},od.s48=function(t){return new fd(6,t)},od.ns64=function(t){return new bd(t)},od.s16be=function(t){return new pd(2,t)},od.s24be=function(t){return new pd(3,t)},od.s32be=function(t){return new pd(4,t)},od.s40be=function(t){return new pd(5,t)},od.s48be=function(t){return new pd(6,t)},od.ns64be=function(t){return new Md(t)},od.f32=function(t){return new Ad(t)},od.f32be=function(t){return new Nd(t)},od.f64=function(t){return new Id(t)},od.f64be=function(t){return new Ed(t)},od.struct=function(t,e,n){return new kd(t,e,n)},od.bits=function(t,e,n){return new Dd(t,e,n)};var Ud=od.seq=function(t,e,n){return new xd(t,e,n)};od.union=function(t,e,n){return new Sd(t,e,n)},od.unionLayoutDiscriminator=function(t,e){return new Ld(t,e)},od.blob=function(t,e){return new Pd(t,e)},od.cstr=function(t){return new _d(t)},od.utf8=function(t,e){return new Bd(t,e)},od.const=function(t,e){return new Rd(t,e)};var Qd={},Yd={exports:{}};!function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"===z(t)?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:nr.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"===z(t))return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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 p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}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 r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.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;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 I(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){I.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return v[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,I),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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,L)}(Yd),function(t){var e=L&&L.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;var n=od,r=Ih,i=e(Yd.exports),o=od;Object.defineProperty(t,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(t,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(t,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(t,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(t,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(t,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(t,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(t,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return o.struct}});var a=function(t){Y(r,t);var e=X(r);function r(t,i,o){var a;return B(this,r),(a=e.call(this,t,o)).blob=n.blob(t),a.signed=i,a}return U(r,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new i.default(this.blob.decode(t,e),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.signed&&(t=t.toTwos(8*this.span)),this.blob.encode(t.toArrayLike(It,"le",this.span),e,n)}}]),r}(n.Layout);function s(t){return new a(8,!1,t)}t.u64=s,t.i64=function(t){return new a(8,!0,t)},t.u128=function(t){return new a(16,!1,t)},t.i128=function(t){return new a(16,!0,t)};var u=function(t){Y(n,t);var e=X(n);function n(t,r,i,o){var a;return B(this,n),(a=e.call(this,t.span,o)).layout=t,a.decoder=r,a.encoder=i,a}return U(n,[{key:"decode",value:function(t,e){return this.decoder(this.layout.decode(t,e))}},{key:"encode",value:function(t,e,n){return this.layout.encode(this.encoder(t),e,n)}},{key:"getSpan",value:function(t,e){return this.layout.getSpan(t,e)}}]),n}(n.Layout);t.publicKey=function(t){return new u(n.blob(32),(function(t){return new r.PublicKey(t)}),(function(t){return t.toBuffer()}),t)};var c=function(t){Y(r,t);var e=X(r);function r(t,i){var o;return B(this,r),(o=e.call(this,-1,i)).layout=t,o.discriminator=n.u8(),o}return U(r,[{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==t?this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+1)+1)}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+1);throw new Error("Invalid option "+this.property)}},{key:"getSpan",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(t,e);if(0===n)return 1;if(1===n)return this.layout.getSpan(t,e+1)+1;throw new Error("Invalid option "+this.property)}}]),r}(n.Layout);function l(t){if(0===t)return!1;if(1===t)return!0;throw new Error("Invalid bool: "+t)}function h(t){return t?1:0}function d(t){var e=n.u32("length"),r=n.struct([e,n.blob(n.offset(e,-e.span),"data")]);return new u(r,(function(t){return t.data}),(function(t){return{data:t}}),t)}t.option=function(t,e){return new c(t,e)},t.bool=function(t){return new u(n.u8(),l,h,t)},t.vec=function(t,e){var r=n.u32("length"),i=n.struct([r,n.seq(t,n.offset(r,-r.span),"values")]);return new u(i,(function(t){return t.values}),(function(t){return{values:t}}),e)},t.tagged=function(t,e,r){var i=n.struct([s("tag"),e.replicate("data")]);return new u(i,(function(e){var n=e.tag,r=e.data;if(!n.eq(t))throw new Error("Invalid tag, expected: "+t.toString("hex")+", got: "+n.toString("hex"));return r}),(function(e){return{tag:t,data:e}}),r)},t.vecU8=d,t.str=function(t){return new u(d(),(function(t){return t.toString("utf-8")}),(function(t){return It.from(t,"utf-8")}),t)},t.rustEnum=function(t,e,r){var i=n.union(null!=r?r:n.u8(),e);return t.forEach((function(t,e){return i.addVariant(e,t,t.property)})),i},t.array=function(t,e,r){var i=n.struct([n.seq(t,e,"values")]);return new u(i,(function(t){return t.values}),(function(t){return{values:t}}),r)};var f=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;return B(this,n),(o=e.call(this,t.span+r.span,i)).keyLayout=t,o.valueLayout=r,o}return U(n,[{key:"decode",value:function(t,e){return e=e||0,[this.keyLayout.decode(t,e),this.valueLayout.decode(t,e+this.keyLayout.getSpan(t,e))]}},{key:"encode",value:function(t,e,n){n=n||0;var r=this.keyLayout.encode(t[0],e,n);return r+this.valueLayout.encode(t[1],e,n+r)}},{key:"getSpan",value:function(t,e){return this.keyLayout.getSpan(t,e)+this.valueLayout.getSpan(t,e)}}]),n}(n.Layout);t.map=function(t,e,r){var i=n.u32("length"),o=n.struct([i,n.seq(new f(t,e),n.offset(i,-i.span),"values")]);return new u(o,(function(t){var e=t.values;return new Map(e)}),(function(t){return{values:Array.from(t.entries())}}),r)}}(Qd),ut.Web3MobileWallet;var Wd=ut.transact,Fd=nr.Buffer,Vd=pr.exports,Hd=Qd.struct([Qd.publicKey("mint"),Qd.publicKey("owner"),Qd.u64("amount"),Qd.u32("delegateOption"),Qd.publicKey("delegate"),Qd.u8("state"),Qd.u32("isNativeOption"),Qd.u64("isNative"),Qd.u64("delegatedAmount"),Qd.u32("closeAuthorityOption"),Qd.publicKey("closeAuthority")]);Qd.array;var Gd=Qd.bool,qd=Qd.i128;Qd.i16;var Zd=Qd.i32,Jd=Qd.i64;Qd.i8,Qd.map;var Xd=Qd.option,Kd=Qd.publicKey,$d=Qd.rustEnum,tf=Qd.str,ef=Qd.struct;Qd.tagged;var nf=Qd.u128,rf=Qd.u16,of=Qd.u32,af=Qd.u64,sf=Qd.u8,uf=Qd.vec;Qd.vecU8;const cf="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yOTkuMyAyMzcuNSA1MDAgMTIybDIwMC43IDExNS41LTczLjUgNDIuNkw1MDAgMjA4LjJsLTEyNy4xIDcxLjktNzMuNi00Mi42em00MDEuNCAxNDYtNzMuNS00Mi42LTEyNy4xIDczTDM3MyAzNDAuNGwtNzMuNSA0My4xdjg1LjdsMTI3LjEgNzN2MTQ1LjRsNzMuNSA0My4xIDczLjUtNDMuMVY1NDIuMWwxMjcuMS03M3YtODUuNnptMCAyMzIuMXYtODUuN2wtNzMuNSA0Mi42djg1LjdjLS4xLS42IDczLjUtNDIuNiA3My41LTQyLjZ6bTUxLjkgMjkuMy0xMjcuMSA3M3Y4NS43TDgyNi4xIDY4OFY0NTYuNGwtNzMuNSA0My4xdjE0NS40em0tNzMuNS0zMzQuNCA3My41IDQzLjF2ODUuN2w3My41LTQzLjF2LTg1LjdsLTczLjUtNDMuMS03My41IDQzLjF6TTQyNi41IDc0OS40djg1LjdsNzMuNSA0My4xIDczLjUtNDMuMXYtODUuN2wtNzMuNSA0Mi03My41LTQyek0yOTkuMyA2MTUuNmw3My41IDQzLjF2LTg2LjJMMjk5LjMgNTMwdjg1LjZ6bTEyNy4yLTMwNS4xIDczLjUgNDMuMSA3My41LTQzLjEtNzMuNS00Mi42YzAtLjUtNzMuNSA0Mi42LTczLjUgNDIuNnptLTE3OS4xIDQzLjEgNzMuNS00My4xLTczLjUtNDMuMS03My41IDQzLjF2ODUuN2w3My41IDQzLjF2LTg1Ljd6bTAgMTQ1LjQtNzMuNS00Mi42VjY4OGwyMDAuNyAxMTUuNXYtODUuN2wtMTI3LjEtNzNjLS4xLjEtLjEtMTQ1LjgtLjEtMTQ1Ljh6IiBmaWxsPSIjZjBiOTBiIi8+PC9zdmc+",lf="https://app.uniswap.org/static/media/bnb-logo.797868eb94521320b78e3967134febbe.svg";var hf={name:"bsc",id:"0x38",networkId:"56",namespace:"eip155",platform:"evm",label:"BNB Smart Chain",fullName:"BNB Smart Chain Mainnet",logo:cf,logoBackgroundColor:"#000000",logoWhiteBackground:cf,currency:{name:"BNB",symbol:"BNB",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:lf},wrapped:{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png"},stables:{usd:["0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d","0x55d398326f99059fF775485246999027B3197955"]},explorer:"https://bscscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://bscscan.com/tx/${t.id||t}`:e?`https://bscscan.com/token/${e}`:n?`https://bscscan.com/address/${n}`:void 0,endpoints:["https://bsc-dataseed.binance.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed3.defibit.io"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"BNB",name:"Binance Coin",decimals:18,logo:lf,type:"NATIVE"},{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",symbol:"WBNB",name:"Wrapped BNB",decimals:18,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png",type:"20"},{address:"0x55d398326f99059fF775485246999027B3197955",symbol:"USDT",name:"Tether USD",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x55d398326f99059fF775485246999027B3197955/logo.png",type:"20"},{address:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",symbol:"USDC",name:"USD Coin",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d/logo.png",type:"20"},{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:"ETH",name:"Ethereum Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x2170Ed0880ac9A755fd29B2688956BD959F933F8/logo.png",type:"20"},{address:"0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",symbol:"Cake",name:"PancakeSwap Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82/logo.png",type:"20"},{address:"0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",symbol:"BTCB",name:"BTCB Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const df="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAADxdJREFUeJztXVtzFMcVplwuP8VVeYmf7HJ+RKqSl/AQP6X8H+yqXUEIjhMnQY5jO9oVCIzA5mowdzAYG4xAGAyWLC5G3IyDL8gOASUYKrarYGZWC7qi23b6692VV6uZ7e6ZnT3di07VV6JUaLfnnG+6z+lz+vScOXUoL6SzP52/2PtlQ9p7piHlLU2k3P2JJqcjkXLO8589/OdN/tPjvx8VEP8Wv+sp/J8O/A3+Fp+Bz8JnUj/XrPjIwjT7ybxm57fJlLsy2eR2cwPe4QZksYB/Nr4D34XvxHdTP/8DJ+k0e4S/lb9Jpr2WZJNzgRtjPDaDS4DvFmPgY8GYMDZq/dStNKQzv0qmnA1c6RkqgysQIoMxYqzU+qoLWZDO/jyZdl7lir1ObdwQZLiOseMZqPVonSTS7i+4AtsTTW6O2pDR4ebEs/Bnotar8dKw2Pk1n0I76Y0W16zgdOIZqfVsnCSbvaeEB2+AkWpCBEQS/Jmp9U4u3Fl6nIdWB6gNQgb+7NABtR1qLjxcejiZdhfxKXGA3AjUswHXAXQBnVDbpSbCPeO5fAr8hlrxpgE6gW6o7ROb5N96Z3l9ePZxgUcMXEd1NxssbMk8kWxyztEr2A5AV3XjGySb3acTSLYYoFjL4EF31PYLLXwaeyiZcltnp/woEJtIrdAltT21BEkR7tnuo1dgfQC6tCbRlGh1H02k3C5qpalg/bt3WdOGDPk4lACdct1S27eiLEgPPMbDmcvkylLAgiUOc/sm2LHuITavmX48KoBun1828DNqO/tKsiX7JF+zeqmVpIqPzg2xyckc++Sfw2ImoB6POtxe6Jra3tMEb75Nxv/Hmxk2MZGbIsCpz4bZn1d45OPSIQF0Tm13IViXbJn2i+i9NcYgRQIA+zsGyMelA6Fzap8AnqktDl8RO9r7WVFKCQAs3dJHPj4tcN2TRQcizrcs1Hv+NZf1D04GEqDj/JBwDqnHqYNCiFj7fYL8Jg+9AnTQfXmYlUo5AYAtbffIx6lNAm6L2hpfbO/atcO3dGsfy+VyUgIAL66yySEE3FzNto2R2ElYtrffkHbYd7fHWbkEEeDQyUHk6cnHrQkPtonV+CKla2FWDx6+nwQRAFi5K0s+bl3ANrGmkvP5fPoH1cFfX/fYyP2cNgG6Lg6z55a55OPXJgG3UVzGn2vbug98fvW+r/FlBADePtJPPn59iKKS6lYW5ad++8q4Vu+5G2h8FQIAr663JFlUAtiqqksBZ1Uj9UPp4neLHeb0TUQmwNEzg2xemv559OE2VsX4KE2ysXoXhpOJCgGAdXttShblAZtVpayMe5Zt1A+ji5fXZdj4uL/jF4YApy4NsxdaLXQIue2iGb/Ze4r6IcLg6rejUuPrEAB47yO7kkVTJIhyAsnG41rYylUVHQIAizdZlixqyh9DC2V8HGKkHrwuELffHZiUWz4kAVBEAueS+jl1EepAqo2ndLFW64guAYBNB2xMFjmdWsbHWXbqQesC0zMMGjcBgEVv2JYs4tDpT5BvzmDAoBWBxM2tH8a0jB+FAAe77EsWwaZKxkdLE9u2fPce65dbu4oEAFp32JYscnNK7WrQ14Z+sOpAMefwiLrjVy0CdF0cYguX2rU3ANtKCWBTdS9wqWcklPGjEgDYcdiuZBEaV1U0PtqbUQ9SB6/vyoY2fjUIALy81q5kUcUWduhxRz1AVcxvdthtb2aVT60JcOT0oKg4otaHKmBjX+OLA50GN2Esx+FT8mRPLQgAIO1MrQ91ArgZ31JytDqlHpwqXlrjsbExvZg/TgKcvDTM/rjcHocQtp45/ae9FuqBqeLr/6gle2pFAAChKLVeVAFbzyRAk3OBemAq2LhfPdlTSwIA6Y12JItg62nGR9tzyq7bqljY4rK+e5WrfCgJcPzskHBOqfUkJQC39bRW9+h9Tz0oFXx8Yahqxo+DAMCGfXY4hLB5SfjnrqQekAypjRntZA8FAU5/NixK0an1JQNsXrL+m1/4ceM7/WRPJcExsas3Rtn7nQNVJ8GBj82vHppWKBLrNStVAOrzqyWjPHzEWQGEbjBW81t9bPn2LNt9tF/UE1SLBMu2Ge4QcpsL4+MyJPLBVADi68HhcMmeUrnbP8kufDUyw8ggQBHoD7Dt4D3WyX2NqASAv/L7Fnr9VYK4CAs3YlEPpBLOfxk+2QP5wRlnZy7ztTnAUKUEKGLJpj72JnfmUFoehQTbDpldPQTb8/Xfe5Z6IEHA1BxWem+N8rdd/ib7EaAUq/dkxZoelgTYtaTWYxBwJR7y/8uoB+IHnMbB26sjY+M59uU1vr5/qj6FywhQxIodWfbOh/2ioZQOAZCzMLV6CLafU7hUkXww5Wjr8j/S7Sdo+3LxyojSGx+WAFN+wtY+tp1P7V0afsIbbxtaPcRtb2T1b+Mqj90flcf8t91x1v158PoeBwGKWLy5j23kfsIxBT/h5KfDoj8RtV7LIaqFTcwBfHUt+Eg35L//G2WnqxSyhSVAKdZwP+FgV2U/Yc9R85JFIieQwH25BgymCHTt9JPxiRy7ch3xe/QQrdoEKGLlzqzICgb5CQb2Je6ZU7g0mXogAmjR5mWnJ3uwB3Dp65nxu4kEKGIZ9xN2tN9jJy5OJ6txfYm57TEDGNPwCdm0otzJTLCzX+T31uMwfJwEmNpP2NLHNu2/y453/0gEw/oSe3MK16dTD2Sqf+/N78diN3qtCDDlMG7qY2v33mWHTg6Y1ZeY294YAhw7Ozi1P19L1IIA0/yEXdxpfMeQWUAQwJAlAClUtHOrdwL8fW3GpBPGnlFOIIDp8lh3dT19EwiAJe4PprWdKziBRoWBALaB1/JpEhsothMAdYJY8w3dDhZh4HkDBuIL7J7t+qDfWgKg57BRYV85uO0xA3SQD0SCl9ZkRP9eWwjwyrqM8bUABXQYkwySpU0xhb62Lcs6z5u7E4idPpUDIn8ypeOYSAYZkg5esTPLPr0yIu2+gd1CnA3QTcvGSYA0B6IY2TpfXNLQxo5a30BDyluKI2HPUA+kCHj/qNlDDl0WKsGxevd49LAxqvGxPM2XjBV+AJpNYp/DpJ1AURBiUkkYvP9i9S9yAnjTZX+DaffoJ+H9g7CGR1j3nEKDCIS12OLGd6HGwaRoQJSEmVYU+rfVHhu+/2MR6LWbo+JMQGUmO6Lo4kSIsDFMWKfSNRRLWWnJOdrPm3aAVBSFmlgWXt7sEQc4kB+QKRBv5Pb2e7ERAIUqssbROL629eDMMSzZbFiZeLEs3NSDISjhLpeh4Umx7ssaMiD+bpMUaOgQAE6b7DYxjAkdS7ouzoxScFUdtT7LMe1giIlHw/AmORn/g6AoFlWps0OdP7p7hiUA/AuVUi74A+gU4vf5KC2XOYkkBCg9Gmbq4VBMm0gRBwkqgGX7B1A+PO+ggpKgsO4vK+VhHXwBVAAFkQuhqqk3kE07HGry8XDU5FcStIWHl40Zo9LnwH9AXZ6MAHBCZUe8EaLiFLBsL2LVbjOrgWccDze5QQTeQpX27zj6tV3hJM4r6zPsg5Lpemr7lv9eRiIA5V4dCruR+wxuLz+jQYTpLWIwHQ8MqZ0P/Pb7MdYiuQMYpMLOI87vIcRU2ZrFUnPwhNp+A7arTb5xzLdFjOlNorCTpio4+o0zhSBOpc+EZy+LKJDD33lYLyNpYPXvNPg2ibKhTRzqA3QE9wUiHAzTtgXx/po9+jUJpreTD2wTlw8HzW4UCY/e7wpYmSCc1NmDRxQQpioJOQzTbxgLbBSZXwbMbxWLmDtsj8B/3RiteA8gMnr7QtYlItEjW3JMQMVWsflZwL1OPUgZEM6FFWwrI2dQWp+H4o3NB/S2kMuBo+zUepFB2ixaEMCSdvFf/Lvy+UGZIKpAW5hiNBDF+Cae+/MlgEq7eFsujMAWbdSegdXoEoZNKFmewAwoXhhRWAasuDIGTRuitI57kNrFK18ZA7Hp0qgPz4RvHhmVACZV90ihc2lUfhYwr3GEHxrS4XsIRiEAchQmVfdUgva1cRCbLo58sayKKG4CIOdvWnVPxZckzMWRYhYwsFAkCDpXxkYlgHHVPRUQ+upYQQDLLo/W7SkYhgAoOaN+Ti0CRLk8GpJIOQeoH0IVSOfeCagiqgYBUH1sYnVPILjtIhkf0pDOPM6diAHyh1EEpufxClVEYQmA4o9Gi66Mhc1gu8gEgCTT7iLqB9KBrIooDAGM7fUXRABus6oYH5JOs4e5M/EN9UNpsF+0gq8WAd4zuLrH9/m5rWCzqhEAkkw7c23YIi4CmTl0EI1KAFHdY9UVsW4Otqqq8UtIsJz+AdWBJhNRCYD0M/Vz6AA2isX4kPxS4JyjfkgdVKoikhHgrfctC/m4bao+9ZfLwpbMEwlDGkupoFIVUSUCtJ80v7qnDB5sE6vxi5Jsdp+2yR9AFdCoTxVREAEwaxjTy08JfN3nNqmJ8adIkHJb6R9cHbt9qoiCCIBOJNTj1QFsUVPjQ/ha8xCPNfdRP7wOcFmUjAC7j9hR3TNlfG4D2KLmBCiQ4JFEyu2iVoIqyquIyglgT3VPAVz3gSXetZJEq/tossm9TK4MRbSWVBGVEwDtXqjHpwqhc657UuMXZUF64DHuiPRSK0UVOLJdTgCcPKIelzrcXuic2u7TJNmSfdIWEhSriIoEsKm6BzqGrqnt7StgpS3LAc7to+MIqntMvM/HD9CtcW9+uWBdssUxxDk+dPGiHocSoFNT1nyZiIOmloWIJqMQ6tF6+7oi9gnEZpE9O4bmwc1Bh2RxfjUkv21sT+7AIHg1396NS5CksC2LSAnoqmaJnVqJSCWLeoLZJSEYophjeewpXUpBtYpN5WW1AnQSWyWPaQKGc7Y32lRtHJvhhQ7cxrp+64NElJw3OW3URqB76522qpVu2yw4vWLTMbTohne7I5/YqUfBIUZbTiWHMjx/ttAHNR8kwVn2fJOKeogYxGZOu/b5/FnJt6vJ9yyyI8tYZvhejF25LcusVBa0N0OPO5ObWWJsGKO0FdushBckRdDqFP1u0fSYsss5vluMgY8FY7IuYVMPgrbn6H2PCxBEJBHn9Tf8s4UHz78L3zmj5fqsmCG4DAk3YiWbvGfFvYgpdz888EJL/J7Chdkerk8XEP8Wv+vJzyo8EsHf8L/FZ+Czpi5YqjP5P2ey0rAsl+yGAAAAAElFTkSuQmCC",ff="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png";var pf={name:"ethereum",id:"0x1",networkId:"1",namespace:"eip155",platform:"evm",label:"Ethereum",fullName:"Ethereum Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbC1vcGFjaXR5Oi42MDJ9LnN0MCwuc3Qxe2ZpbGw6I2ZmZn08L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik01MTEuNCA3My4zdjMxNS41TDc3OCA1MDggNTExLjQgNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNTExLjQgNzMuMyAyNDQuNyA1MDhsMjY2LjYtMTE5LjJWNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNNTExLjQgNzEyLjN2MjE0LjVsMjY2LjgtMzY5LjEtMjY2LjggMTU0LjZ6Ii8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTUxMS40IDkyNi43VjcxMi4zTDI0NC43IDU1Ny42bDI2Ni43IDM2OS4xeiIvPjxwYXRoIGQ9Ik01MTEuNCA2NjIuNyA3NzggNTA4IDUxMS40IDM4OC44djI3My45eiIgZmlsbD0iI2ZmZiIgZmlsbC1vcGFjaXR5PSIuMiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im0yNDQuNyA1MDggMjY2LjYgMTU0LjdWMzg4LjhMMjQ0LjcgNTA4eiIvPjwvc3ZnPgo=",logoBackgroundColor:"#5683ec",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGltYWdlLXJlbmRlcmluZz0ib3B0aW1pemVRdWFsaXR5IiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgdGV4dC1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4PSIwIiB5PSIwIiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGU+LnN0MXtmaWxsOiM4YzhjOGN9PC9zdHlsZT48cGF0aCBkPSJtNDk5LjggNzcuNS01LjUgMTl2NTU5LjFsNS41IDUuNSAyNTkuNy0xNTMuNUw0OTkuOCA3Ny41eiIgZmlsbD0iIzM0MzQzNCIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Im00OTkuOCA3Ny41LTI1OS4zIDQzMEw0OTkuOCA2NjFWNzcuNXoiLz48cGF0aCBkPSJtNDk5LjggNzEwLjMtMi45IDR2MTk5LjFsMi45IDkuMSAyNTkuNy0zNjUuOC0yNTkuNyAxNTMuNnoiIGZpbGw9IiMzYzNjM2IiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNDk5LjggOTIyLjVWNzEwLjNMMjQwLjUgNTU2LjdsMjU5LjMgMzY1Ljh6Ii8+PHBhdGggZD0ibTQ5OS44IDY2MSAyNTkuNy0xNTMuNS0yNTkuNy0xMTcuOFY2NjF6IiBmaWxsPSIjMTQxNDE0Ii8+PHBhdGggZD0iTTI0MC41IDUwNy41IDQ5OS44IDY2MVYzODkuN0wyNDAuNSA1MDcuNXoiIGZpbGw9IiMzOTM5MzkiLz48L3N2Zz4K",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:df},wrapped:{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",logo:ff,logoBackgroundColor:"#FFFFFF"},stables:{usd:["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]},explorer:"https://etherscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://etherscan.io/tx/${t.id||t}`:e?`https://etherscan.io/token/${e}`:n?`https://etherscan.io/address/${n}`:void 0,endpoints:["https://rpc.ankr.com/eth","https://eth.llamarpc.com","https://ethereum.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:df,type:"NATIVE"},{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:ff,type:"20"},{address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c/logo.png",type:"20"},{address:"0xdAC17F958D2ee523a2206206994597C13D831ec7",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x6B175474E89094C44Da98b954EedeAC495271d0F",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x853d955aCEf822Db058eb8505911ED77F175b99e",symbol:"FRAX",name:"Frax",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x853d955aCEf822Db058eb8505911ED77F175b99e/logo.png",type:"20"},{address:"0x956F47F50A910163D8BF957Cf5846D573E7f87CA",symbol:"FEI",name:"Fei USD",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x956F47F50A910163D8BF957Cf5846D573E7f87CA/logo.png",type:"20"},{address:"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const yf="https://assets.spooky.fi/tokens/FTM.png",mf="https://assets.spooky.fi/tokens/wFTM.png";var gf={name:"fantom",id:"0xfa",networkId:"250",namespace:"eip155",label:"Fantom",fullName:"Fantom Opera",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00NjcgMTM1LjVjMTgtOS4zIDQ1LjEtOS4zIDYzIDBsMTgzLjQgOTdjMTAuNyA2LjEgMTYuNiAxNCAxOCAyMy4zdjQ4Ni42YzAgOS4zLTYuMSAxOS4yLTE4IDI1LjJsLTE4My4yIDk3Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTgzLjMtOTdjLTExLjktNi4xLTE3LjItMTUuOS0xOC0yNS4yVjI1NS43Yy43LTguNyA2LjctMTcuMiAxNy4yLTIzLjNMNDY3IDEzNS41em0yMzUuOCAzODkuNy0xNzIuNiA5MC45Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTcxLjktOTAuM3YyMTQuNGwxNzEuOSA5MC4zYzEwIDUuMyAyMC42IDEwLjcgMzEuMiAxMS4zaC43YzEwIDAgMjAtNS4zIDMwLjUtMTBsMTc0LTkyLjMtLjgtMjE0LjN6TTIzNy4zIDczMS4xYzAgMTguNiAyIDMxLjIgNi43IDM5LjggMy4zIDcuMyA4LjcgMTIuNiAxOC42IDE5LjJsLjcuN2MyIDEuNCA0LjcgMi42IDcuMyA0LjdsMy4zIDIgMTAuNyA2LjEtMTQuNiAyNC42LTExLjMtNy4zLTItMS40Yy0zLjMtMi02LjEtNC04LjctNS4zLTI3LjktMTguNi0zNy44LTM5LjItMzcuOC04MS42di0xLjRoMjcuMXpNNDg1IDM5Ni40Yy0xLjQuNy0yLjYuNy00IDEuNGwtMTgzLjIgOTYuOWgtLjcuN2wxODMuMyA5N2MxLjQuNyAyLjYgMS40IDQgMS40bC0uMS0xOTYuN3ptMjkuMyAwdjE5Ny44YzEuNC0uNyAyLjYtLjcgNC0xLjRsMTgzLjMtOTdoLjctLjdsLTE4My4zLTk4LjJjLTEuNC0uNS0yLjgtMS4yLTQtMS4yem0xODguNS0xMDctMTY0LjcgODYuMyAxNjQuNyA4Ni40VjI4OS40em0tNDA3LjcgMHYxNzMuM2wxNjQuNy04Ni4zLTE2NC43LTg3em0yMjIuNS0xMjhjLTkuMy01LjMtMjYuNS01LjMtMzYuNiAwbC0xODMuMiA5N2gtLjcuN2wxODMuMyA5N2M5LjMgNS4zIDI2LjUgNS4zIDM2LjYgMGwxODMuMy05N2guNy0uN2wtMTgzLjQtOTd6bTIxMi41IDkuMyAxMS4zIDcuMyAyIDEuNGMzLjMgMiA2LjEgNCA4LjcgNS4zIDI3LjkgMTguNiAzNy44IDM5LjIgMzcuOCA4MS42djEuNGgtMjguN2MwLTE4LjYtMi0zMS4yLTYuNy0zOS44LTMuMy03LjMtOC43LTEyLjYtMTguNi0xOS4ybC0uNy0uN2MtMi0xLjQtNC43LTIuNi03LjMtNC43bC0zLjMtMi0xMC43LTYuMSAxNi4yLTI0LjV6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#226efb",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iNDI1IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE5NjlmZiIvPjxwYXRoIGQ9Ik00NzQuMSAyMTAuM2MxNC4zLTcuNCAzNS45LTcuNCA1MC4yIDBsMTQ1LjkgNzcuMmM4LjUgNC44IDEzLjIgMTEuMSAxNC4zIDE4LjV2Mzg3LjVjMCA3LjQtNC44IDE1LjMtMTQuMyAyMC4xbC0xNDUuOSA3Ny4yYy0xNC4zIDcuNC0zNS45IDcuNC01MC4yIDBsLTE0NS45LTc3LjJjLTkuNS00LjgtMTMuNy0xMi43LTE0LjMtMjAuMVYzMDZjLjUtNi45IDUuMy0xMy43IDEzLjctMTguNS4xIDAgMTQ2LjUtNzcuMiAxNDYuNS03Ny4yem0xODcuNyAzMTAuM0w1MjQuMyA1OTNjLTE0LjMgNy40LTM1LjkgNy40LTUwLjIgMGwtMTM2LjktNzEuOXYxNzAuN2wxMzYuOSA3MS45YzcuOSA0LjIgMTYuNCA4LjUgMjQuOCA5aC41YzcuOSAwIDE1LjktNC4yIDI0LjMtNy45bDEzOC41LTczLjVWNTIwLjZoLS40ek0yOTEuMiA2ODQuNWMwIDE0LjggMS42IDI0LjggNS4zIDMxLjcgMi42IDUuOCA2LjkgMTAgMTQuOCAxNS4zbC41LjVjMS42IDEuMSAzLjcgMi4xIDUuOCAzLjdsMi42IDEuNiA4LjUgNC44LTExLjYgMTkuNi05LTUuOC0xLjYtMS4xYy0yLjYtMS42LTQuOC0zLjItNi45LTQuMi0yMi4yLTE0LjgtMzAuMS0zMS4yLTMwLjEtNjV2LTEuMWgyMS43em0xOTcuMi0yNjYuNGMtMS4xLjUtMi4xLjUtMy4yIDEuMWwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzEuMS41IDIuMSAxLjEgMy4yIDEuMVY0MTguMXptMjMuMiAwdjE1Ny41YzEuMS0uNSAyLjEtLjUgMy4yLTEuMWwxNDUuOS03Ny4yaC41LS41bC0xNDUuOS03OC4yYy0xLjEtLjUtMi4xLTEtMy4yLTF6TTY2MS44IDMzM2wtMTMxLjEgNjguNyAxMzEuMSA2OC43VjMzM3ptLTMyNC42IDB2MTM4bDEzMS4xLTY4LjdjMC0uMS0xMzEuMS02OS4zLTEzMS4xLTY5LjN6bTE3Ny4xLTEwMi4xYy03LjQtNC4yLTIxLjEtNC4yLTI5LjEgMGwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzcuNCA0LjIgMjEuMSA0LjIgMjkuMSAwbDE0NS45LTc3LjJoLjUtLjVsLTE0NS45LTc3LjJ6bTE2OS4xIDcuNCA5IDUuOCAxLjYgMS4xYzIuNiAxLjYgNC44IDMuMiA2LjkgNC4yIDIyLjIgMTQuOCAzMC4xIDMxLjIgMzAuMSA2NXYxLjFoLTIyLjdjMC0xNC44LTEuNi0yNC44LTUuMy0zMS43LTIuNi01LjgtNi45LTEwLTE0LjgtMTUuM2wtLjUtLjVjLTEuNi0xLjEtMy43LTIuMS01LjgtMy43bC0yLjYtMS42LTguNS00LjggMTIuNi0xOS42eiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",currency:{name:"Fantom",symbol:"FTM",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:yf},wrapped:{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",logo:mf},stables:{usd:["0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf","0x1B6382DBDEa11d97f24495C9A90b7c88469134a4"]},explorer:"https://ftmscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://ftmscan.com/tx/${t.id||t}`:e?`https://ftmscan.com/token/${e}`:n?`https://ftmscan.com/address/${n}`:void 0,endpoints:["https://rpc.ftm.tools","https://fantom.publicnode.com","https://rpc2.fantom.network"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"FTM",name:"Fantom",decimals:18,logo:yf,type:"NATIVE"},{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",symbol:"WFTM",name:"Wrapped Fantom",decimals:18,logo:mf,type:"20"},{address:"0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf",symbol:"lzUSDC",name:"LayerZero USDC",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"},{address:"0x1B6382DBDEa11d97f24495C9A90b7c88469134a4",symbol:"axlUSDC",name:"Axelar Wrapped USDC",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const vf="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/info/logo.png",wf="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/assets/0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270/logo.png";var bf={name:"polygon",id:"0x89",networkId:"137",namespace:"eip155",label:"Polygon (POS)",fullName:"Polygon (POS) Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMzEuNSA0NTkuM2MtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnYxOTQuNGMwIDE5LjIgOS42IDM2IDI0IDQzLjJsMTY1LjYgOTZjMTQuNCA5LjYgMzMuNiA5LjYgNDggMGwxNjUuNi05NmMxNC40LTkuNiAyNC0yNCAyNC00My4ydi02OS42bC03Ni44LTQzLjJ2NjQuOGMwIDE5LjItOS42IDM2LTI0IDQzLjJsLTg2LjQgNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtODYuNC01MC40Yy0xNC40LTkuNi0yNC0yNC0yNC00My4yVjU1MC41YzAtMTkuMiA5LjYtMzYgMjQtNDMuMmw4OC44LTUwLjRjMTQuNC05LjYgMzMuNi05LjYgNDggMGwxMTIuOCA2NC44IDc2LjggNDUuNiAxMTIuOCA2NC44YzE0LjQgOS42IDMzLjYgOS42IDQ4IDBsMTY4LTk2YzE0LjQtOS42IDI0LTI0IDI0LTQzLjJ2LTE5MmMwLTE0LjQtOS42LTMxLjItMjQtNDAuOGwtMTY4LTk2Yy0xNC40LTkuNi0zMy42LTkuNi00OCAwbC0xNjUuNiA5NmMtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnY2OS42bDc2LjggNDUuNnYtNjkuNmMwLTE5LjIgOS42LTM2IDI0LTQzLjJsODguOC01Mi44YzE0LjQtOS42IDMzLjYtOS42IDQ4IDBsODguOCA1MC40YzE0LjQgOS42IDI0IDI0IDI0IDQzLjJ2MTAwLjhjMCAxOS4yLTEyIDM2LTI0IDQzLjJsLTg4LjggNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtMTEyLjgtNjkuNi03OS4yLTQzLjItMTE3LjYtNjkuNmMtMTQuNC05LjYtMzMuNi05LjYtNDggMCAwIDIuNC0xNjAuOCA5OC40LTE2My4yIDk4LjR6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#824ee2",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMDkuNyA0NTljLTE2LjQgOS40LTI1LjggMjUuOC0yNS44IDQ2Ljl2MjA2LjNjMCAyMS4xIDkuNCAzNy41IDI1LjggNDYuOWwxNzUuOCAxMDMuMWMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBsMTc1LjgtMTAzLjFjMTYuNC05LjQgMjUuOC0yNS44IDI1LjgtNDYuOXYtNzIuN2wtODItNDYuOXY2OGMwIDIxLjEtOS40IDM3LjUtMjUuOCA0Ni45TDMzNyA3NjEuNGMtMTYuNCA5LjQtMzUuMiA5LjQtNTEuNiAwTDE5NCA3MDcuNWMtMTYuNC05LjQtMjUuOC0yNS44LTI1LjgtNDYuOVY1NTIuOGMwLTIxLjEgOS40LTM3LjUgMjUuOC00Ni45bDkzLjgtNTMuOWMxNC4xLTkuNCAzNS4yLTkuNCA1MS42IDBsMTE5LjUgNjggODIgNDkuMiAxMTkuNSA2OGMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBMODkwLjIgNTM0YzE2LjQtOS40IDI1LjgtMjUuOCAyNS44LTQ2LjlWMjgzLjJjMC0xNi40LTkuNC0zMi44LTI1LjgtNDIuMkw3MTIuMSAxMzcuOWMtMTYuNC05LjQtMzUuMi05LjQtNTEuNiAwTDQ4NC43IDI0MWMtMTYuNCA5LjQtMjUuOCAyNS44LTI1LjggNDYuOXY3NWw4MiA0OS4ydi03Mi43YzAtMjEuMSA5LjQtMzcuNSAyNS44LTQ2LjlsOTMuOC01Ni4zYzE2LjQtOS40IDM1LjItOS40IDUxLjYgMGw5My44IDUzLjljMTQuMSA5LjQgMjUuOCAyNS44IDI1LjggNDYuOXYxMDhjMCAyMS4xLTExLjcgMzcuNS0yNS44IDQ2LjlsLTkzLjggNTYuM2MtMTQuMSA5LjQtMzUuMiA5LjQtNTEuNiAwTDU0MSA0NzUuNGwtODItNDYuOS0xMjQuMi03Mi43Yy0xNC4xLTkuNC0zNS4yLTkuNC01MS42IDAtLjEuMS0xNzEuMiAxMDMuMi0xNzMuNSAxMDMuMnoiIGZpbGw9IiM4MjQ3ZTUiLz48L3N2Zz4=",currency:{name:"Polygon",symbol:"MATIC",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:vf},wrapped:{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",logo:wf},stables:{usd:["0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359","0xc2132D05D31c914a87C6611C10748AEb04B58e8F"]},explorer:"https://polygonscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://polygonscan.com/tx/${t.id||t}`:e?`https://polygonscan.com/token/${e}`:n?`https://polygonscan.com/address/${n}`:void 0,endpoints:["https://polygon-rpc.com","https://polygon.meowrpc.com","https://polygon-bor.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"MATIC",name:"Polygon",decimals:18,logo:vf,type:"NATIVE"},{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",symbol:"WMATIC",name:"Wrapped Matic",decimals:18,logo:wf,type:"20"},{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",type:"20"},{address:"0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xf6261529C6C2fBEB313aB25cDEcD243613b40EB5",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Mf="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDp1cmwoI1NWR0lEXzAwMDAwMDE5Njc2ODQzODE5NzI3MzAwODIwMDAwMDA1OTQ3NjMyODMzODYxMjM4OTE3Xyl9LnN0MntmaWxsOnVybCgjU1ZHSURfMDAwMDAwNjQzMjA1MjE4MTcxODM4NzM1NjAwMDAwMDMxNzkyNDIxNTkzMzkwODM5NjdfKX08L3N0eWxlPjxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfMV8iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iODE1Ljg1NiIgeTE9IjcwLjgyNCIgeDI9IjM4OC4zMzYiIHkyPSItNzQ4LjA1MiIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSA2NTcuOWM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDc5NS4xYy00LjkgNC45LTEyLjIgNy4zLTE3LjEgNy4zSDEyNS4zYy0xMi4yIDAtMTcuMS0xNC43LTkuOC0yNC41bDEyMi40LTEyMHoiIGZpbGw9InVybCgjU1ZHSURfMV8pIi8+PGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8wMDAwMDE1MDgxNTQ0MzI2NzI2OTc2MDQ0MDAwMDAxMzQ2MDgyNDM3MDQwMzE3MjU0M18iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iNjI4LjQ4MSIgeTE9IjE2NC4xMzQiIHgyPSIyMDAuOTYyIiB5Mj0iLTY1NC43NCIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSAyMDQuOGM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDM0MmMtNC45IDQuOS0xMi4yIDcuMy0xNy4xIDcuM0gxMjUuM2MtMTIuMiAwLTE3LjEtMTQuNy05LjgtMjJsMTIyLjQtMTIyLjV6IiBmaWxsPSJ1cmwoI1NWR0lEXzAwMDAwMTUwODE1NDQzMjY3MjY5NzYwNDQwMDAwMDEzNDYwODI0MzcwNDAzMTcyNTQzXykiLz48bGluZWFyR3JhZGllbnQgaWQ9IlNWR0lEXzAwMDAwMDA3NDA5ODc3MzYzMTA0OTgxNjMwMDAwMDE1MTMzNzA1NTcwNjgwMDk3NzA5XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI3MjAuOTIzIiB5MT0iMTE1Ljg3IiB4Mj0iMjkzLjQwNiIgeTI9Ii03MDMuMDAzIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMTkxLjQzNSkiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzAwZmZhMyIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2RjMWZmZiIvPjwvbGluZWFyR3JhZGllbnQ+PHBhdGggZD0iTTc2Mi4xIDQzMC4xYy00LjktNC45LTEyLjItNy4zLTE3LjEtNy4zSDEyNS4zYy0xMi4yIDAtMTcuMSAxNC43LTkuOCAyMkwyMzggNTY3LjNjNC45IDQuOSAxMi4yIDcuMyAxNy4xIDcuM2g2MTkuN2MxMi4yIDAgMTcuMS0xNC43IDkuOC0yMkw3NjIuMSA0MzAuMXoiIGZpbGw9InVybCgjU1ZHSURfMDAwMDAwMDc0MDk4NzczNjMxMDQ5ODE2MzAwMDAwMTUxMzM3MDU1NzA2ODAwOTc3MDlfKSIvPjwvc3ZnPgo=",Af="https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png";var Nf={name:"solana",networkId:"solana",namespace:"solana",label:"Solana",fullName:"Solana Mainnet Beta",logo:Mf,logoBackgroundColor:"#000000",logoWhiteBackground:Mf,currency:{name:"Solana",symbol:"SOL",decimals:9,address:"11111111111111111111111111111111",logo:Af},wrapped:{address:"So11111111111111111111111111111111111111112",logo:Af},stables:{usd:["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"]},explorer:"https://solscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://solscan.io/tx/${t.id||t}`:e?`https://solscan.io/token/${e}`:n?`https://solscan.io/address/${n}`:void 0,endpoints:["https://solana.a.exodus.io","https://mainnet-beta.solflare.network","https://swr.xnftdata.com/rpc-proxy"],sockets:["wss://solana.drpc.org","wss://mainnet-beta.solflare.network","wss://solana.a.exodus.io"],tokens:[{address:"11111111111111111111111111111111",symbol:"SOL",name:"Solana",decimals:9,logo:Af,type:"NATIVE"},{address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://img.raydium.io/icon/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v.png",type:"SPL"},{address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",symbol:"USDT",name:"USDT",decimals:6,logo:"https://img.raydium.io/icon/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB.png",type:"SPL"},{address:"7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj",symbol:"stSOL",name:"Lido Staked SOL",decimals:9,logo:"https://img.raydium.io/icon/7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj.png",type:"SPL"},{address:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",symbol:"BONK",name:"BONK",decimals:5,logo:"https://img.raydium.io/icon/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263.png",type:"SPL"},{address:"7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",symbol:"SAMO",name:"Samoyed Coin",decimals:9,logo:"https://img.raydium.io/icon/7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU.png",type:"SPL"},{address:"DePay1miDBPWXs6PVQrdC5Vch2jemgEPaiyXLNLLa2NF",symbol:"DEPAY",name:"DePay",decimals:9,logo:"https://depay.com/favicon.png",type:"SPL"}],zero:"0",maxInt:"340282366920938463463374607431768211455"};const If="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDojMjEzMTQ3fTwvc3R5bGU+PHBhdGggZD0iTTkyIDkyaDgxNnY4MTZIOTJWOTJ6IiBmaWxsPSJub25lIi8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTE2NS44IDM0MC4xVjY2MGMwIDIwLjYgMTAuOCAzOS4yIDI4LjcgNDkuNmwyNzcuMSAxNTkuOWMxNy42IDEwLjEgMzkuNSAxMC4xIDU3LjEgMGwyNzcuMS0xNTkuOWMxNy42LTEwLjEgMjguNy0yOSAyOC43LTQ5LjZWMzQwLjFjMC0yMC42LTEwLjgtMzkuMi0yOC43LTQ5LjZsLTI3Ny4xLTE2MGMtMTcuNi0xMC4xLTM5LjUtMTAuMS01Ny4xIDBsLTI3Ny4xIDE2MGMtMTcuNiAxMC4xLTI4LjQgMjktMjguNCA0OS42aC0uM3oiLz48cGF0aCBkPSJtNTYwLjQgNTYyLTM5LjUgMTA4LjRjLTEgMi45LTEgNi4yIDAgOS41bDY3LjkgMTg2LjQgNzguNi00NS40LTk0LjMtMjU4LjhjLTIuMy02LTEwLjQtNi0xMi43LS4xem03OS4zLTE4Mi4xYy0yLjMtNS45LTEwLjQtNS45LTEyLjcgMGwtMzkuNSAxMDguNGMtMSAyLjktMSA2LjIgMCA5LjVMNjk4LjggODAzbDc4LjYtNDUuNC0xMzcuNy0zNzcuNHYtLjN6IiBmaWxsPSIjMTJhYWZmIi8+PHBhdGggZD0iTTUwMCAxNDIuNmMyIDAgMy45LjYgNS41IDEuNmwyOTkuNiAxNzNjMy42IDIgNS41IDUuOSA1LjUgOS44djM0NmMwIDMuOS0yLjMgNy44LTUuNSA5LjhsLTI5OS42IDE3M2MtMS42IDEtMy42IDEuNi01LjUgMS42cy0zLjktLjYtNS41LTEuNmwtMjk5LjYtMTczYy0zLjYtMi01LjUtNS45LTUuNS05LjhWMzI2LjdjMC0zLjkgMi4zLTcuOCA1LjUtOS44bDI5OS42LTE3M2MxLjYtMSAzLjYtMS42IDUuNS0xLjZ2LjN6bTAtNTAuNmMtMTAuOCAwLTIxLjIgMi42LTMxIDguMmwtMjk5LjYgMTczYy0xOS4yIDExLjEtMzEgMzEuMy0zMSA1My41djM0NmMwIDIyLjIgMTEuOCA0Mi40IDMxIDUzLjVsMjk5LjYgMTczYzkuNSA1LjUgMjAuMiA4LjIgMzEgOC4yczIxLjItMi42IDMxLTguMmwyOTkuNi0xNzNjMTkuMi0xMS4xIDMxLTMxLjMgMzEtNTMuNXYtMzQ2YzAtMjIuMi0xMS44LTQyLjQtMzEtNTMuNWwtMjk5LjktMTczYy05LjUtNS41LTIwLjItOC4yLTMxLTguMmguM3oiIGZpbGw9IiM5ZGNjZWQiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJtMzAxLjUgODAzLjIgMjcuOC03NS43IDU1LjUgNDYtNTEuOSA0Ny43LTMxLjQtMTh6Ii8+PHBhdGggZD0iTTQ3NC41IDMwMi4yaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOEwyMjIuOSA3NTcuNWw3OC42IDQ1LjRMNDgxLjEgMzExYzEuNi00LjYtMS42LTkuMS02LjItOS4xbC0uNC4zem0xMzMuMiAwaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOGwtMTg2IDUwOS44IDc4LjYgNDUuNEw2MTMuOSAzMTFjMS42LTQuNi0xLjYtOS4xLTYuMi05LjF2LjN6IiBmaWxsPSIjZmZmIi8+PC9zdmc+Cg==";var Ef={name:"arbitrum",id:"0xa4b1",networkId:"42161",namespace:"eip155",platform:"evm",label:"Arbitrum",fullName:"Arbitrum One",logo:If,logoBackgroundColor:"#2b354d",logoWhiteBackground:If,currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:pf.currency.logo},wrapped:{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",logo:pf.wrapped.logo},stables:{usd:["0xaf88d065e77c8cC2239327C5EDb3A432268e5831","0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"]},explorer:"https://arbiscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://arbiscan.io/tx/${t.id||t}`:e?`https://arbiscan.io/token/${e}`:n?`https://arbiscan.io/address/${n}`:void 0,endpoints:["https://arbitrum.blockpi.network/v1/rpc/public","https://arbitrum-one.publicnode.com","https://endpoints.omniatech.io/v1/arbitrum/one/public"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:pf.currency.logo,type:"NATIVE"},{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:pf.wrapped.logo,type:"20"},{address:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8/logo.png",type:"20"},{address:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1/logo.png",type:"20"},{address:"0x912CE59144191C1204E64559FE8253a0e49E6548",symbol:"ARB",name:"Arbitrum",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0x912CE59144191C1204E64559FE8253a0e49E6548/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const xf="https://traderjoexyz.com/static/media/avalanche.7c81486190237e87e238c029fd746008.svg",kf="https://raw.githubusercontent.com/traderjoe-xyz/joe-tokenlists/main/logos/0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7/logo.png";var Tf={name:"avalanche",id:"0xa86a",networkId:"43114",namespace:"eip155",platform:"evm",label:"Avalanche",fullName:"Avalanche C-Chain",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0zNTkuMSA3NTEuMWgtOTUuM2MtMjAgMC0yOS45IDAtMzYtMy44LTYuNi00LjMtMTAuNC0xMS4zLTEwLjktMTguOS0uMy03LjEgNC42LTE1LjggMTQuNC0zM2wyMzUtNDE0LjNjMTAuMS0xNy42IDE1LjEtMjYuNCAyMS40LTI5LjYgNi45LTMuNSAxNS4xLTMuNSAyMS45IDAgNi40IDMuMyAxMS40IDEyIDIxLjQgMjkuNmw0OC40IDg0LjMuMi41YzEwLjggMTguOSAxNi4zIDI4LjUgMTguNiAzOC41IDIuNiAxMC45IDIuNiAyMi42IDAgMzMuNS0yLjQgMTAuMS03LjggMTkuOC0xOC44IDM4LjlMNDU2LjIgNjk0LjlsLS4zLjVjLTEwLjggMTktMTYuMyAyOC43LTI0LjEgMzYtOC4zIDgtMTguMyAxMy43LTI5LjMgMTYuOS05LjkgMi44LTIxLjEgMi44LTQzLjQgMi44em0yNDAuMyAwaDEzNi40YzIwLjIgMCAzMC4yIDAgMzYuMy00IDYuNi00LjMgMTAuNi0xMS4zIDEwLjktMTkuMS4zLTYuOS00LjUtMTUuMi0xMy45LTMxLjZsLTEtMS43TDY5OS44IDU3OGwtLjgtMS4yYy05LjYtMTYuMy0xNC40LTI0LjUtMjAuNy0yNy42LTYuOS0zLjYtMTUtMy42LTIxLjcgMC02LjIgMy4zLTExLjMgMTEuOC0yMS4zIDI5bC02OC4xIDExNi45LS4yLjNjLTEwLjEgMTcuMi0xNSAyNS44LTE0LjUgMzIuOC41IDcuNyA0LjUgMTQuOSAxMC45IDE5IDUuNyAzLjkgMTUuOCAzLjkgMzYgMy45eiIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#E84142",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yMzUuNiAyNTkuNWg1MjguOXY0ODFIMjM1LjZ2LTQ4MXoiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNOTI4IDUwMGMwIDIzNi40LTE5MS42IDQyOC00MjggNDI4UzcyIDczNi40IDcyIDUwMCAyNjMuNiA3MiA1MDAgNzJzNDI4IDE5MS42IDQyOCA0Mjh6TTM3OC43IDY3MC4zaC04My4xYy0xNy41IDAtMjYuMSAwLTMxLjMtMy40LTUuNy0zLjctOS4xLTkuOC05LjYtMTYuNS0uMy02LjIgNC0xMy44IDEyLjYtMjguOUw0NzIuNSAyNjBjOC43LTE1LjQgMTMuMS0yMyAxOC43LTI1LjkgNi0zIDEzLjEtMyAxOS4xIDAgNS42IDIuOCAxMCAxMC41IDE4LjcgMjUuOWw0Mi4yIDczLjYuMi40YzkuNCAxNi41IDE0LjIgMjQuOCAxNi4zIDMzLjYgMi4zIDkuNiAyLjMgMTkuNiAwIDI5LjItMi4xIDguOC02LjggMTcuMi0xNi40IDM0TDQ2My42IDYyMS4ybC0uMy41Yy05LjUgMTYuNi0xNC4zIDI1LTIxIDMxLjQtNy4zIDYuOS0xNiAxMi0yNS41IDE0LjgtOC43IDIuNC0xOC41IDIuNC0zOC4xIDIuNHptMjA5LjggMGgxMTljMTcuNiAwIDI2LjQgMCAzMS43LTMuNSA1LjctMy43IDkuMi05LjkgOS42LTE2LjYuMy02LTMuOS0xMy4zLTEyLjItMjcuNWwtLjktMS41LTU5LjYtMTAyLS43LTEuMWMtOC40LTE0LjItMTIuNi0yMS4zLTE4LTI0LjEtNi0zLTEzLjEtMy0xOSAwLTUuNSAyLjgtOS45IDEwLjMtMTguNiAyNS4zbC01OS40IDEwMi0uMi40Yy04LjcgMTUtMTMgMjIuNS0xMi43IDI4LjcuNCA2LjcgMy45IDEyLjkgOS42IDE2LjYgNSAzLjMgMTMuOCAzLjMgMzEuNCAzLjN6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2U4NDE0MiIvPjwvc3ZnPg==",currency:{name:"Avalanche",symbol:"AVAX",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:xf},wrapped:{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",logo:kf},stables:{usd:["0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7","0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"]},explorer:"https://snowtrace.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://snowtrace.io/tx/${t.id||t}`:e?`https://snowtrace.io/token/${e}`:n?`https://snowtrace.io/address/${n}`:void 0,endpoints:["https://avalanche.public-rpc.com","https://avalanche.blockpi.network/v1/rpc/public","https://avax.meowrpc.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"AVAX",name:"Avalanche",decimals:18,logo:xf,type:"NATIVE"},{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",symbol:"WAVAX",name:"Wrapped AVAX",decimals:18,logo:kf,type:"20"},{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7/logo.png",type:"20"},{address:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E/logo.png",type:"20"},{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xd586E7F844cEa2F87f50152665BCbc2C279D8d70/logo.png",type:"20"},{address:"0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Lf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAMAAAAKTh9YAAAAYFBMVEVHcEz////////////////////////////////////j++ma6qVj5nsl5lAK4zpA6mXO79aD8Zyr87uCvq0J2TkItEkOhl4EeVsKzSwLrxMNtQpjsZG42dEeuxyF2oU6wzjPwJjeAAAACnRSTlMAEUB9r9j/YO+Kf6/iMwAABD1JREFUeAHU1EESQjEMAlBIAq33v7ArV7+OLss7AZOB4IDVI/kW0nQRf+Ca7QvNwg/s7VtpGJP8oPFNybdT4aidoPHEcYZn6ymnEEOjH8KPk0zeTI+DLacpfMhpxKTGnFtDB9o8/Jisw8uxh1/OtGIrYw9Ah9pEOVWhnaoxTvWCnErR2Z3rzX59JMYOAkEYXr1gRJfIzP1PalbOpZm2aEf+tcKnCCz7bS37si/7si/7si/7si/7srvRHAE5kJHdbV4wkn076Q9RMMLu04fYnceT/An9JnhMkr19Ezwvvvee73ieOL1dfdN15yQlwas2S7vbgTn4iLfaDO0emIPPeLtgZt+AOfhcQHJGdieYg88VLG9k98AUfG7gBRu7YAo+9wpeNLEnYAY+915wkIndQ4Xn9IajgoV9hwbP6b3iqGRhF5zH537VHi3swGl87tft3tB+Ap/7Z9lFhef0z3hndmjwnP4Z32qEAs/po4//Rwao8JzeC3hiMyeACs/ppnMCUlThOf3wxjurObAKz+kHNz5arT0CNHhO5zde7NZ8UYXn9N4K2Utnt8NzOsFL+Kuz2+EJneA5nduN8bmTWsXzKqNzuyX+FZ3rL43Sud0Un/txtV7KqNY+6Hq7Kb71Gxt0W7seX5od/Z6a+8BuGASCMMwraRK4103A9z9leq+Q3zCYC+h7oy7tbr6d4zGd2zme04Ed4AEd2AEe0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2Tl+B+jQzvH7j/ThnNub4Xd7Rud2gLc9pyM7wO9sz+nEDvA7e8G/0vX2IeTan/DXPdWL+cwD/hl/c3r2lT2u7XbWk31aYt9vesp9yD5Xn1ZPx7svtNtMYwfX9/hqjwAvuq8awIufZwzgxc+RZgAvfn43gBe/N5lxPLAD+sTs2HgnS53jnS51jHfC1CneKVOHeCdNneGdNnWEd+LUCd6pUwd4p04d4J06dYB3tekAL64nSAAvr+PgeGYHdI6ndkDneGoHdI4HdkAvxw/V7IsiegU8sIdSejk+VbIvyumveBY8twdQh51A8PL691x8PBf3HRD8oO33QPhR2mfD8EnZ3wTxXthXRvFe18+H8anbPsqkOVfnnJ6DF/RmPdE5vs69aQiYnoH3rXuzXukcP6jmE3C8734uxAgfgSvM4+D4RcV37SmgZ+BT6/kz0yd6KT5+kcex9bel+fDPupXP+MOs8byl6esGYfRxbDPnanG0OVf+8ODeH9Ks5f+mE50vJlp37d23EQQhFATRr6Yg/4RPuSe9o6tmIni7gN2222677bbbbrvttttuu5sw/7EP1j7kfhO6m5Wbak90Jw7d54NeGsV9jb0y1B+f+P5qpHB08XvD8M4zrq9N7pqje/L8jj/twXa8XOl4uSoe4/363RnvlyOo/LE1R8JnZfywrB7pGLY0Xa/gV5AhY9e5oJHCAAAAAElFTkSuQmCC",Sf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAYAAAA9kO9qAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0PSURBVHgB7d1LbFzVHcfx37l3/CDGxgkhxEnU2K1EgxoUN0kVUglhIhbdVAo7dpCiSl2BqbqphIRpuy5u95SwY1XSWlXVIhFXtGqjJsXQSJRCsXklaQiJ8zCxPTP3cv53cuOxZ8bjmbmP8z/n/5GMHcfjmPHXZ86ce++xQpJGxwdRwChCtQ9Q+nU4qt87CIVhCLGeEHP6v/NQag5h8DY8TKOEGcxMziMhCp2iwD0c1V/kE/QnUNxCJGdavxzHmRdfQYfajz2K3HsGKhyHBC7SN6dznUY5eEGP9nNoQ+uxS+Qib6GawL9++QJa1FrsB8fH9D/0sn5rGELka04PuMdwenJ6ozfwN/qB2D/+vP7ZOA4ZzYUZdIfqSQx9Fzj/979s5AbNR3aatvieHs3DoxDCSOqEnssfa7Zys37s0VKiOqmXhUYhhMlCvUwZhI+sF3zj2CV0wU2T4L2GN6Spi4QuOFG612jKXV/9J6j0ZFThRxCCnz2NnrTWTmMqy4snIQRnSk9n1ixL1k5jKuvoQvBGHdPzziqrY4/W0uWAkbDCMDw1Xv2OlWnM6PgwfDULIewxj3I4Eq/OrIzsvpqAEHYZrB7dq6cxD0MI2yg8E8/dK7HvH38SMlcXdqpcb4E49sqFF0LY6VbfqnKil7oCIewVPVH1omtGhbBbdG20hwBjEMJ2AcWuvH0QwnYK+zyE4TCEsF2oaGSXy+yEA3TntPQ4DCHsN+xBCEdI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwRgEWU30loK9c+cOCj3DB6v/dtqltS7ffDi/2wFZWffcpbv/IJXh7r8Hfe70SexWKPZjdhPKpzdGLzd/Y9dD9Uzh0BR69VIUeo/somO1D6c0tCN6y50I2hQPPhmCORqauxz9D4cjnLd2u9MY9KL6605noC9+/EN1PaweB9dB9Q/cR3VfcsY+9nW/gWsWpIRRf+hpspUa+RM/T/4OnX7eLol987n7WAwPb2Cnurqdn9cPxZSTBhm9mPfRo1/XUxx0NBtWWX9qN0tR2cMRyNYa+cT2/eDex0KPPqadCvfpzqjpzWK4Kj51D99MfJhY66X7qo+jRlCOWsdNI1clDciM2Be8/9AW6n/gEaaDg6UkuN+xip1Gl1SeirbAheH/0Krp/OIc09fz0v4k+YmSBVewUYBYPoZyD976xgMLjn0INpBui0scv6BGWE1ax06qLl1GAHIOn0D09qvt7biAL9Airdic/nUwLq9iznidyCj4KXb/438l2q/2uR9ObUiaNTex+g6N9aeMQfBx69PaORWTJPyKxJ45iz4vJwVeHrrYupz5XX4vm7mpkARywiT3v0EwMvjr0SH8RefBHeMzb2cTuGXCHmhR8Tej0Pj2y54HLk3g+I7sha7omBF8v9EhPgDxI7BbLM/iGoedpyQcHbGIPDDtBK4/gm4a+lM+3M7zK47IINrGbeDZilsFvZEQPr3UhD3ShBwd8Yp/dBBNlEfxGpy7huV7kIfjkDnDAJvbSqc0wVZrBtzJHD68X9Oie7ZSCHnHz+iFrFZ85+9kBoy+YTiP4dp6MBu/diSwV/3gvuGC1GlOaMvuOTTL4dlddyu/chTDDJ6rlv20BF8xiHzJuVWatJILvaHlRhx68M4AsFF/dxeoyRlaxhws+ln/9dZiuk+CTWEePRveU5+7xrgOcsDuoRHN3DndyO8EndsBIj+6l3w2lNp2h5050cTo3LI+g0sOnbcEnfWSUVmZKJ5IPPg6d4y4MPnYcngBDNMIT2vnLZHQKLO2+RTuQocFqUmqnANz0EX5wZ3QSnUrgvJnwcjcWJ/YYe8yjGbaxExuCT/1cl2VPx9kXxa46OCuy/O8BLP38Pr2mzuMAUj2sYyecg8/spC4dPB3SD/7T33L0wWe9KP15G5Z/sxuY7wZnVuz1SLoe/zS6INt08c5jqr+U29mL9G+rHYt6erMQnRZMf7799ekfDFzqRqBfwvf6EdzwUT6tf0Cv898D15rYCZvg9dy3+Id7jQ8oLCprQidWnc/OZpVmyzK6jp4H+s3dZMi20Il1F2+wCV6HbmrwNoZOrLxSSYJvn62hE2svy5PgW2dz6MTqa1Al+I2zPXRi/QXXEnxzLoROnNhdQIJvzJXQiTNbaUjwtVwKnTi1b4wEv8K10IlzmyRJ8G6GTpzcEczl4F0NnTi7/R234NWmzi/idjl04vRej6yCf/R9qJ4OfmnvTc/p0InzG5tyCR67+tB94FRbwUvoFbKLL3gF3/PAmy0Ffzv0mzx22k2TxH4Lh+DDzVug+pY2HLyEvprEXsX44H0fwcBdUL1fNg1eQq8lsa9BwZemtsNYd1QueG4WvIReS2KvI9rWzdRNVLtXLnpuFHxAu+pK6DUk9jpom73gbD9MFPau3sqiXvDhZzy2kM6axN4ABc9FTfBlBVFLYm9Abcvn1yw2VS7Xffft4PuuAr35/NY800nsddDejP7eazBSg9hJHLw/fBGilsReh8l7z6jFm+v/faGI3u+9Dm/7FxCrSexr0EZLhSOfw1Tqxo3mH6OD3/SD30vwa0jsVTjsKKYWmscefVzvsgS/hsR+C4vQr1xed85e8/ES/CoSO/jsEen9/wJaJcGvcD52LqGrS/p5xHJ7y6ESfIXTsXMJnSL3znX2dUrwDsfOKXT/ww+QBNeDdzJ2dqEvJ3c01+XgnYvd5dBjrgbvVOwS+goXg3cmdgm9lmvBOxG7hN6YS8FbH7uE3pwrwVsdu4S+cS4Eb23sEnrrbA/eytgl9PbZHLx1sUvonbM1eKtiZ/Mbrq8pY0OP2Ri8NbGzCf1iDxZ/sg9Lf3oAprMteCtiZxX6c/dHr5dPHsTSyQMwnU3Bs4+dY+gxCT5brGPnHHpMgs8O29htCD0mwWeDZew2hR7jFrwavA5u2MVeOHTZutBjvIKf0q87/6VmWeIX+1Mfw3TthB7jErynR/auw2fBCavYaacub5vZo0knoce4BN99+B1Wozuv2A2fviQReoxD8DSd4TS6s4nd23vN6FE9ydBjHILv+vZ74IJN7IVDV2CqNEKPmR48zd25rMywiV2NtP/bndOUZugx04P3R86BAz6xGziFySL0mMnBezKyJ8u0+XqWocdMDd7r57EiI7v4tiGP0GNcliVNxCZ2U34vaZ6hx0wLPrie333RCj6xX+xG3kwIPWZS8MH8ZnDAJvbg7ADyZFLoMVOCD84PggM2sZdO5Td6mBh6LO/gg/l+BBfuBgd8pjGzfbnM200OPZZn8OXZIXDB6Amqj9LUvcgSh9BjeQW/pP9dLlgtPZamhjIb3TmFHss6+OJb9yHU0xguWMVOo3vx1R1IG8fQYxT84m/HkDaaq3Ma1Qm7g0o0upfeuAdp4Rx6rDjzzdSDX5p6mNWoTlgeQS2+tBvB7CYkzYbQY2kGv/j6gyi9vxPc+NhxeALcFD2U/7oVatdNeLsWkQT64Vn62R4rQo8FF7YivNIPf+Q8VGHjvxm7kXCxR4/oD6F46lvgSOHAsyEYS2KngdLUdv1cYKcxpyQkjc5KvOPYFLzN7Z+dGJy/Gzdfe4TNmno97GMndPovRV84cqml25X1UVmKPO+js1mhq4q6x860FD09EV1+cz+K/9wD7qyIPUbR0+V7/qEr8Pdeh+orrfp7GrlpulLWR2PLb2y1diRvxh8+F4VPmx35Q6s3PApLXQg+H0B5Ti8EvDuiX6e/+pUVq2Kv5/ZFH3rZ0tW4m4l2COitbJ/NbYWlFdZ/9216wpkWeuKJRfvvJ7l4QzhDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyj2OQhhvzkPIeYhhO105zr28G0IYTsVfuRBYQZC2C7EjKdn7RK7sJ+HaQ+lKHaZtwu7lWhkn5mk0GV0Fzabps4r6+xh+AqEsNdx+k8l9gAnIFMZYaNQH0c682I0mFdip6lMGP4KQthGhdPxmyunCwSYhIzuwjZlvBC/uRK7jO7CNkqHPjM5F/9x9YlgNLqHcq6MsAB1fPrFiep3rY6dRncvPAYhuKvTsV/zQef+MYedDyr9GDAGITii6cvpyeO1727kwI9f048FRyEEK+EJnJl8rN7fNL54oxwco5NnIAQX1GsZDafhat0bj44PwlMn9UeNQgiTUehB+Mit01/qWv+yPLohfQKoExDCWHrq0iR0sv7IXu3g+ARC9TyEMEn0ZHT1EmPjD23FwfExBOplfathCJEnWken5cXTk9MbvUlrscdklBd5oWumPX2kv6QPgDaZtqzVXuxkdHwYvtLR42EZ6UXqOog81n7s1faPP6k/0xNyIEokigJX4Yx+/Up0GnqbkceSiT1GS5UFvUwZYEx/5n36ixzW/8SgjPyiqeicrHC+sgGAmtGRvx1dMtph4NW+AiZycfiu2QTRAAAAAElFTkSuQmCC";var jf={name:"gnosis",id:"0x64",networkId:"100",namespace:"eip155",label:"Gnosis",fullName:"Gnosis Chain",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojZmZmfTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMzMS45IDU1Ni41YzIzLjUgMCA0Ni40LTcuOCA2NS0yMi4yTDI0OCAzODUuNGMtMzUuOSA0Ni40LTI3LjQgMTEyLjkgMTguOSAxNDguOCAxOC42IDE0IDQxLjUgMjEuOSA2NSAyMS45di40em00NDIuMy0xMDYuMWMwLTIzLjUtNy44LTQ2LjQtMjIuMi02NUw2MDMuMiA1MzQuMmM0Ni40IDM1LjkgMTEyLjkgMjcuNCAxNDguOC0xOC45IDE0LjMtMTguNiAyMi4yLTQxLjQgMjIuMi02NC45eiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im04NDkuMiAyODguNS02NS45IDY1LjljNTIuOSA2My42IDQ0LjcgMTU4LTE4LjkgMjExLjItNTUuNiA0Ni43LTEzNi42IDQ2LjctMTkyLjIgMEw1MDAgNjM3LjdsLTcyLjEtNzIuMWMtNjMuNiA1Mi45LTE1OCA0NC43LTIxMS4yLTE4LjktNDYuNy01NS42LTQ2LjctMTM2LjYgMC0xOTIuMmwtMzMuNi0zMy42LTMyLTMyLjNDMTEyLjMgMzUyLjIgOTIgNDI1LjMgOTIgNTAwYzAgMjI1LjIgMTgyLjggNDA4IDQwOCA0MDhzNDA4LTE4Mi44IDQwOC00MDhjLjMtNzQuNC0yMC42LTE0Ny44LTU4LjgtMjExLjV6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTc5NS4xIDIxOC4zYy0xNTUuNC0xNjIuOC00MTMuNi0xNjktNTc2LjQtMTMuNy00LjkgNC42LTkuNSA5LjEtMTMuNyAxMy43LTEwLjEgMTAuOC0xOS42IDIxLjktMjguNyAzMy4zTDUwMCA1NzUuNGwzMjMuOC0zMjMuOGMtOC44LTExLjctMTguNi0yMi44LTI4LjctMzMuM3pNNTAwIDE0NS4yYzk1LjMgMCAxODQuMSAzNi45IDI1MSAxMDMuOEw1MDAgNTAwIDI0OSAyNDljNjYuNi02Ny4yIDE1NS43LTEwMy44IDI1MS0xMDMuOHoiLz48L3N2Zz4K",logoBackgroundColor:"#406958",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojM2U2OTU3fTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMyNC4yIDU1OS4xYzI0LjYgMCA0OC41LTguMiA2Ny45LTIzLjJMMjM2LjUgMzgwLjJjLTM3LjUgNDguNS0yOC43IDExOC4xIDE5LjggMTU1LjYgMTkuNSAxNC43IDQzLjMgMjIuOSA2Ny45IDIyLjl2LjR6TTc4Ni43IDQ0OC4xYzAtMjQuNi04LjItNDguNS0yMy4yLTY3LjlMNjA3LjkgNTM1LjhjNDguNSAzNy41IDExOC4xIDI4LjcgMTU1LjYtMTkuOCAxNS0xOS40IDIzLjItNDMuMyAyMy4yLTY3Ljl6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0ibTg2NS4yIDI3OC44LTY4LjkgNjguOWM1NS4zIDY2LjYgNDYuOCAxNjUuMi0xOS44IDIyMC44LTU4LjQgNDguOC0xNDIuNyA0OC44LTIwMSAwTDUwMCA2NDRsLTc1LjQtNzUuNGMtNjYuNiA1NS4zLTE2NS4yIDQ2LjgtMjIwLjgtMTkuOC00OC44LTU4LjQtNDguOC0xNDIuNyAwLTIwMWwtMzUuMi0zNS4yLTMzLjQtMzMuOGMtNDAuNiA2Ni42LTYxLjggMTQzLTYxLjggMjIxLjIgMCAyMzUuNSAxOTEuMSA0MjYuNiA0MjYuNiA0MjYuNlM5MjYuNiA3MzUuNSA5MjYuNiA1MDBjLjQtNzcuOC0yMS41LTE1NC42LTYxLjQtMjIxLjJ6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTgwOC42IDIwNS41QzY0Ni4xIDM1LjEgMzc2LjEgMjguNyAyMDUuOCAxOTEuMWMtNS4xIDQuOC05LjkgOS42LTE0LjMgMTQuMy0xMC42IDExLjMtMjAuNSAyMi45LTMwIDM0LjhMNTAwIDU3OC44bDMzOC42LTMzOC42Yy05LjItMTIuMi0xOS41LTIzLjgtMzAtMzQuN3pNNTAwIDEyOWM5OS43IDAgMTkyLjUgMzguNiAyNjIuNSAxMDguNUw1MDAgNTAwIDIzNy41IDIzNy41QzMwNy4yIDE2Ny4yIDQwMC4zIDEyOSA1MDAgMTI5eiIvPjwvc3ZnPgo=",currency:{name:"xDAI",symbol:"xDAI",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Lf},wrapped:{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",logo:Sf},stables:{usd:["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"]},explorer:"https://gnosisscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://gnosisscan.io/tx/${t.id||t}`:e?`https://gnosisscan.io/token/${e}`:n?`https://gnosisscan.io/address/${n}`:void 0,endpoints:["https://rpc.gnosis.gateway.fm","https://rpc.gnosischain.com","https://gnosis.blockpi.network/v1/rpc/public"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"xDAI",name:"xDAI",decimals:18,logo:Lf,type:"NATIVE"},{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",symbol:"WXDAI",name:"Wrapped XDAI",decimals:18,logo:Sf,type:"20"},{address:"0x4ECaBa5870353805a9F068101A40E0f32ed605C6",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb",symbol:"GNO",name:"Gnosis",decimals:18,logo:"https://cdn.sushi.com/image/upload/f_auto,c_limit,w_16,q_auto/tokens/100/0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb.jpg",type:"20"},{address:"0xD057604A14982FE8D88c5fC25Aac3267eA142a08",symbol:"HOPR",name:"HOPR",decimals:18,logo:"https://hoprnet.org/assets/icons/hopr_icon.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"},Cf={name:"optimism",id:"0xa",networkId:"10",namespace:"eip155",label:"Optimism",fullName:"Optimism",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00ODcuMSAzOTUuN2MtNS4yLTE1LjgtMTMuMi0zMS43LTI2LjQtNDIuMi0xMy4yLTEwLjUtMjYuNC0yMS4yLTQ0LjktMjYuNC0xOC41LTUuMi0zNy04LTU4LjEtOC00Ny41IDAtODcuMSAxMC41LTExNi4xIDM0LjQtMjkgMjMuOC00Ny41IDU4LjEtNjAuNyAxMDIuOS0yLjYgMTUuOC04IDI5LTEwLjUgNDQuOS0yLjYgMTMuMi01LjIgMjktOCA0Mi4yLTIuNiAyMy44LTIuNiA0Mi4yIDIuNiA2MC43IDUuMiAxNS44IDEzLjIgMzEuNyAyNi40IDQyLjIgMTMuMiAxMC41IDI2LjQgMjEuMiA0NC45IDI2LjQgMTguNCA1LjIgMzcgOCA1OC4xIDggNDcuNSAwIDg3LjEtMTAuNSAxMTYuMS0zNC40czQ3LjUtNTguMSA2MC43LTEwMi45YzIuNi0xMy4yIDUuMi0yOSAxMC41LTQyLjIgMi42LTEzLjIgNS4yLTI5IDgtNDQuOSAyLjgtMjMuOCAyLjgtNDQuOC0yLjYtNjAuN3ptLTkyLjQgNjAuOGMtMi42IDEzLjItNS4yIDI2LjQtOCAzOS41LTIuNiAxMy4yLTUuMiAyNi40LTEwLjUgNDIuMi01LjIgMjMuOC0xNS44IDM5LjUtMjkgNTAuMi0xMy4yIDEwLjUtMjkgMTUuOC00Ny41IDE1LjgtMTguNCAwLTMxLjctNS4yLTM5LjUtMTUuOC04LTEwLjUtMTAuNS0yOS01LjItNTAuMiAyLjYtMTUuOCA1LjItMjkgOC00Mi4yIDIuNi0xMy4yIDUuMi0yNi40IDEwLjUtMzkuNSA1LjItMjMuOCAxNS44LTM5LjUgMjktNTAuMiAxMy4yLTEwLjUgMjktMTUuOCA0Ny41LTE1LjggMTguNCAwIDMxLjcgNS4yIDM5LjUgMTUuOCA3LjkgMTAuNiAxMC41IDI2LjMgNS4yIDUwLjJ6bTQ0MC45LTY4LjZjLTUuMi0xNS44LTEzLjItMjYuNC0yMy44LTM3cy0yMy44LTE1LjgtNDIuMi0yMS4yYy0xNS44LTUuMi0zNC40LTgtNTUuNC04SDU3OS43Yy0yLjYgMC01LjIgMC0xMC41IDIuNi0yLjYgMi42LTUuMiA1LjItNS4yIDhsLTY4LjYgMzI3LjRjMCAyLjYgMCA4IDIuNiA4IDIuNiAyLjYgNS4yIDIuNiA4IDIuNmg2OC42YzIuNiAwIDggMCAxMC41LTIuNnM1LjItNS4yIDUuMi04bDIzLjgtMTEwLjloNjguNmM0Mi4yIDAgNzYuNi04IDEwMi45LTI2LjQgMjYuNC0xOC40IDQyLjItNDcuNSA1MC4yLTg0LjYgNS4xLTE4LjQgNS4xLTM2LjctLjItNDkuOXpNNzQzLjEgNDM4Yy0yLjYgMTUuOC0xMC41IDI2LjQtMjEuMiAzNC40cy0yMy44IDEwLjUtMzcgMTAuNWgtNTguMWwxOC40LTg5LjdoNjAuN2MxMy4yIDAgMjEuMiAyLjYgMjYuNCA1LjIgNS4yIDUuMiAxMC41IDEwLjUgMTAuNSAxNS44IDMgNS4yIDMgMTMuMi4zIDIzLjh6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",logoBackgroundColor:"#FF0420",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iMzk2LjYiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNNTAwIDg5Ni42YzIxOS4xIDAgMzk2LjYtMTc3LjYgMzk2LjYtMzk2LjZTNzE5LjEgMTAzLjQgNTAwIDEwMy40IDEwMy40IDI4MC45IDEwMy40IDUwMCAyODAuOSA4OTYuNiA1MDAgODk2LjZ6TTM1MC43IDYwOWMxMC45IDMuNCAyMi42IDUuMSAzNS4zIDUuMSAyOS4xIDAgNTIuNC02LjcgNjkuNi0yMC4yIDE3LjMtMTMuNyAyOS4zLTM0LjMgMzYuMi02MS44IDItOC42IDMuOS0xNy4zIDUuNy0yNS45IDItOC42IDMuNy0xNy40IDUuMS0yNi4yIDIuNC0xMy43IDItMjUuNi0xLjItMzUuOS0zLTEwLjItOC4zLTE4LjktMTYtMjUuOS03LjQtNy0xNi42LTEyLjMtMjcuNC0xNS43LTEwLjctMy42LTIyLjMtNS40LTM1LTUuNC0yOS4zIDAtNTIuNyA3LTY5LjkgMjEuMXMtMjkuMiAzNC43LTM1LjkgNjEuOGMtMiA4LjgtNCAxNy42LTYgMjYuMi0xLjggOC42LTMuNSAxNy4zLTUuMSAyNS45LTIuMiAxMy43LTEuOCAyNS42IDEuMiAzNS45IDMuMiAxMC4yIDguNSAxOC44IDE2IDI1LjYgNy40IDYuOCAxNi42IDExLjkgMjcuNCAxNS40em02Ny44LTQ4Yy04LjIgNi40LTE3LjggOS42LTI4LjYgOS42LTExLjEgMC0xOS0zLjItMjMuOC05LjYtNC44LTYuNC02LTE2LjctMy42LTMwLjcgMS42LTguOCAzLjItMTcuMiA0LjgtMjUgMS44LTcuOCAzLjgtMTYgNi0yNC40IDMuNC0xNC4xIDkuMS0yNC4zIDE3LjItMzAuNyA4LjItNi40IDE3LjgtOS42IDI4LjYtOS42czE4LjggMy4yIDIzLjggOS42IDYuMiAxNi43IDMuNiAzMC43Yy0xLjQgOC40LTMgMTYuNi00LjggMjQuNC0xLjYgNy44LTMuNSAxNi4yLTUuNyAyNS0zLjQgMTQtOS4yIDI0LjMtMTcuNSAzMC43em05MS43IDQ4YzEuMiAxLjQgMi44IDIuMSA0LjggMi4xaDQxYzIuMiAwIDQuMS0uNyA1LjctMi4xIDEuOC0xLjQgMi45LTMuMiAzLjMtNS40bDEzLjktNjZoNDAuN2MyNS45IDAgNDYuNS01LjUgNjEuOC0xNi42IDE1LjUtMTEuMSAyNS43LTI4LjEgMzAuNy01MS4yIDIuNC0xMS43IDIuMy0yMS44LS4zLTMwLjQtMi42LTguOC03LjItMTYuMi0xMy45LTIyLTYuNi01LjgtMTUtMTAuMS0yNS0xMy05LjgtMi44LTIwLjktNC4yLTMzLjItNC4yaC04MC4yYy0yIDAtMy45LjctNS43IDIuMS0xLjggMS40LTIuOSAzLjItMy4zIDUuNEw1MDkgNjAzLjVjLS40IDIuMiAwIDQgMS4yIDUuNXptMTExLjItMTEzLjFoLTM0LjdsMTEuOC01NGgzNi4yYzcuMiAwIDEyLjYgMS4yIDE2IDMuNiAzLjYgMi40IDUuNyA1LjYgNi4zIDkuNi42IDQgLjQgOC42LS42IDEzLjktMiA5LTYuMyAxNS44LTEzIDIwLjItNi40IDQuNS0xMy44IDYuNy0yMiA2Ljd6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmMDQyMCIvPjwvc3ZnPg==",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:pf.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:pf.wrapped.logo},stables:{usd:["0x94b008aA00579c1307B0EF2c499aD98a8ce58e58","0x7F5c764cBc14f9669B88837ca1490cCa17c31607"]},explorer:"https://optimistic.etherscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://optimistic.etherscan.io/tx/${t.id||t}`:e?`https://optimistic.etherscan.io/token/${e}`:n?`https://optimistic.etherscan.io/address/${n}`:void 0,endpoints:["https://optimism.blockpi.network/v1/rpc/public","https://optimism.meowrpc.com","https://optimism.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:pf.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:pf.wrapped.logo,type:"20"},{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x94b008aA00579c1307B0EF2c499aD98a8ce58e58/logo.png",type:"20"},{address:"0x7F5c764cBc14f9669B88837ca1490cCa17c31607",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x7F5c764cBc14f9669B88837ca1490cCa17c31607/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x4200000000000000000000000000000000000042",symbol:"OP",name:"Optimism",decimals:18,logo:"https://user-images.githubusercontent.com/1300064/219575413-d7990d69-1d21-44ef-a2b1-e9c682c79802.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"},Df={name:"base",id:"0x2105",networkId:"8453",namespace:"eip155",label:"Base",fullName:"Base",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguNiA4NDJDNjg4IDg0MiA4NDIgNjg4LjkgODQyIDQ5OS41UzY4OCAxNTcgNDk4LjYgMTU3QzMxOSAxNTcgMTcxLjIgMjk1LjEgMTU3IDQ3MC4zaDQ1My4xdjU3LjVIMTU3QzE3MiA3MDMuOSAzMTkgODQyIDQ5OC42IDg0MnoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#0052FF",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguOSA4NDVDNjkwLjEgODQ1IDg0NSA2OTAuMyA4NDUgNDk5LjVTNjkwLjEgMTU0IDQ5OC45IDE1NEMzMTcuNiAxNTQgMTY4LjggMjkzLjMgMTU0IDQ3MC41aDQ1Ny40djU4LjFIMTU0QzE2OC44IDcwNS44IDMxNy42IDg0NSA0OTguOSA4NDV6IiBmaWxsPSIjMDA1MmZmIi8+PC9zdmc+",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:pf.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:pf.wrapped.logo},stables:{usd:["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA"]},explorer:"https://basescan.org",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://basescan.org/tx/${t.id||t}`:e?`https://basescan.org/token/${e}`:n?`https://basescan.org/address/${n}`:void 0,endpoints:["https://base.blockpi.network/v1/rpc/public","https://base.meowrpc.com","https://mainnet.base.org"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:pf.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:pf.wrapped.logo,type:"20"},{address:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA",symbol:"USDbC",name:"USD Base Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Of=[pf,hf,bf,Nf,gf,Ef,Tf,jf,Cf,Df];var zf={ethereum:pf,bsc:hf,polygon:bf,solana:Nf,fantom:gf,arbitrum:Ef,avalanche:Tf,gnosis:jf,optimism:Cf,base:Df,all:Of,findById:function(t){let e=t;return e.match("0x0")&&(e=e.replace(/0x0+/,"0x")),Of.find((t=>t.id&&t.id.toLowerCase()==e.toLowerCase()))},findByNetworkId:function(t){return t=t.toString(),Of.find((e=>e.networkId==t))},findByName:function(t){return Of.find((e=>e.name==t))}},Pf="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _f(t){var e={exports:{}};return t(e,e.exports),e.exports}for(var Bf=[],Rf=[],Uf="undefined"!=typeof Uint8Array?Uint8Array:Array,Qf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yf=0,Wf=Qf.length;Yf0)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 Vf(t,e,n){for(var r,i,o=[],a=e;a>18&63]+Bf[i>>12&63]+Bf[i>>6&63]+Bf[63&i]);return o.join("")}Rf["-".charCodeAt(0)]=62,Rf["_".charCodeAt(0)]=63;var Hf=function(t){var e,n,r=Ff(t),i=r[0],o=r[1],a=new Uf(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),s=0,u=o>0?i-4:i;for(n=0;n>16&255,a[s++]=e>>8&255,a[s++]=255&e;return 2===o&&(e=Rf[t.charCodeAt(n)]<<2|Rf[t.charCodeAt(n+1)]>>4,a[s++]=255&e),1===o&&(e=Rf[t.charCodeAt(n)]<<10|Rf[t.charCodeAt(n+1)]<<4|Rf[t.charCodeAt(n+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e),a},Gf=function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,a=0,s=n-r;as?s:a+o));return 1===r?(e=t[n-1],i.push(Bf[e>>2]+Bf[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(Bf[e>>10]+Bf[e>>4&63]+Bf[e<<2&63]+"=")),i.join("")},qf=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},Zf=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;t[n+f]=255&a,f+=p,a/=256,c-=8);t[n+f-p]|=128*y},Jf=_f((function(t,e){const n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){return+t!=t&&(t=0),o.alloc(+t)},e.INSPECT_MAX_BYTES=50;const r=2147483647;function i(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|d(t,e);let r=i(n);const a=r.write(t,e);return a!==n&&(r=r.slice(0,a)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(H(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(H(t,ArrayBuffer)||t&&H(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(H(t,SharedArrayBuffer)||t&&H(t.buffer,SharedArrayBuffer)))return l(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return o.from(r,e,n);const a=function(t){if(o.isBuffer(t)){const e=0|h(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||G(t.length)?i(0):c(t):"Buffer"===t.type&&Array.isArray(t.data)?c(t.data):void 0}(t);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return s(t),i(t<0?0:0|h(t))}function c(t){const e=t.length<0?0:0|h(t.length),n=i(e);for(let r=0;r=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function d(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||H(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(t).length;default:if(i)return r?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function f(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,n);case"utf8":case"utf-8":return N(this,e,n);case"ascii":return E(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function p(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:m(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):m(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,n,r,i){let o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){let r=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let a;for(r>o/2&&(r=o/2),a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?Gf(t):Gf(t.slice(e,n))}function N(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+a<=n){let n,r,s,u;switch(a){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],s=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(t){const e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(o.isBuffer(e)||(e=o.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!o.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},o.byteLength=d,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(t+=" ... "),""},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(t,e,n,r,i){if(H(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const u=Math.min(a,s),c=this.slice(r,i),l=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return g(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return w(this,t,e,n);case"base64":return b(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function E(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function S(t,e,n,r,i,a){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function j(t,e,n,r,i){R(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,n}function C(t,e,n,r,i){R(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=a,a>>=8,t[n+2]=a,a>>=8,t[n+1]=a,a>>=8,t[n]=a,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,4),Zf(t,e,n,r,23,4),n+4}function z(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,8),Zf(t,e,n,r,52,8),n+8}o.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readBigUInt64LE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readBigInt64LE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||L(t,4,this.length),qf(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),qf(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),qf(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),qf(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||S(this,t,e,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r||S(this,t,e,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigUInt64LE=Z((function(t,e=0){return j(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Z((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,t,e,n,r-1,-r)}let i=0,o=1,a=0;for(this[e]=255&t;++i>0)-a&255;return e+n},o.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,t,e,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/o>>0)-a&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigInt64LE=Z((function(t,e=0){return j(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Z((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(t,e,n){return O(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return O(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return z(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return z(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function R(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new P.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){U(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||Q(e,t.length-(n+1))}(r,i,o)}function U(t,e){if("number"!=typeof t)throw new P.ERR_INVALID_ARG_TYPE(e,"number",t)}function Q(t,e,n){if(Math.floor(t)!==t)throw U(t,n),new P.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new P.ERR_BUFFER_OUT_OF_BOUNDS;throw new P.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}_("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),_("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),_("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=B(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=B(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const Y=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let a=0;a55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.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;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(t){return Hf(function(t){if((t=(t=t.split("=")[0]).trim().replace(Y,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function H(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function G(t){return t!=t}const q=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}})),Xf=_f((function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Jf.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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 p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}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 r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.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;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 I(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){I.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return v[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,I),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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,Pf)})); -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */let Kf=!1,$f=!1;const tp={debug:1,default:2,info:2,warning:3,error:4,off:5};let ep=tp.default,np=null;const rp=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(n){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var ip,op;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(ip||(ip={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(op||(op={}));const ap="0123456789abcdef";class sp{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();null==tp[n]&&this.throwArgumentError("invalid log level name","logLevel",t),ep>tp[n]||console.log.apply(console,e)}debug(...t){this._log(sp.levels.DEBUG,t)}info(...t){this._log(sp.levels.INFO,t)}warn(...t){this._log(sp.levels.WARNING,t)}makeError(t,e,n){if($f)return this.makeError("censored error",e,{});e||(e=sp.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((t=>{const e=n[t];try{if(e instanceof Uint8Array){let n="";for(let t=0;t>4],n+=ap[15&e[t]];r.push(t+"=Uint8Array(0x"+n+")")}else r.push(t+"="+JSON.stringify(e))}catch(e){r.push(t+"="+JSON.stringify(n[t].toString()))}})),r.push(`code=${e}`),r.push(`version=${this.version}`);const i=t;let o="";switch(e){case op.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case op.CALL_EXCEPTION:case op.INSUFFICIENT_FUNDS:case op.MISSING_NEW:case op.NONCE_EXPIRED:case op.REPLACEMENT_UNDERPRICED:case op.TRANSACTION_REPLACED:case op.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(t+=" ("+r.join(", ")+")");const a=new Error(t);return a.reason=i,a.code=e,Object.keys(n).forEach((function(t){a[t]=n[t]})),a}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,sp.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,r){t||this.throwError(e,n,r)}assertArgument(t,e,n,r){t||this.throwArgumentError(e,n,r)}checkNormalize(t){rp&&this.throwError("platform missing String.prototype.normalize",sp.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:rp})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,sp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,sp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",te&&this.throwError("too many arguments"+n,sp.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",sp.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",sp.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",sp.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return np||(np=new sp("logger/5.7.0")),np}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",sp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Kf){if(!t)return;this.globalLogger().throwError("error censorship permanent",sp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}$f=!!t,Kf=!!e}static setLogLevel(t){const e=tp[t.toLowerCase()];null!=e?ep=e:sp.globalLogger().warn("invalid log level - "+t)}static from(t){return new sp(t)}}sp.errors=op,sp.levels=ip;const up=new sp("bytes/5.7.0");function cp(t){return!!t.toHexString}function lp(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return lp(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function hp(t){return vp(t)&&!(t.length%2)||fp(t)}function dp(t){return"number"==typeof t&&t==t&&t%1==0}function fp(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!dp(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function pp(t,e){if(e||(e={}),"number"==typeof t){up.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),lp(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),cp(t)&&(t=t.toHexString()),vp(t)){let n=t.substring(2);n.length%2&&("left"===e.hexPad?n="0"+n:"right"===e.hexPad?n+="0":up.throwArgumentError("hex data is odd-length","value",t));const r=[];for(let t=0;tpp(t))),n=e.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(n);return e.reduce(((t,e)=>(r.set(e,t),t+e.length)),0),lp(r)}function mp(t){let e=pp(t);if(0===e.length)return e;let n=0;for(;ne&&up.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(e);return n.set(t,e-t.length),lp(n)}function vp(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const wp="0123456789abcdef";function bp(t,e){if(e||(e={}),"number"==typeof t){up.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=wp[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),cp(t))return t.toHexString();if(vp(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":up.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(fp(t)){let e="0x";for(let n=0;n>4]+wp[15&r]}return e}return up.throwArgumentError("invalid hexlify value","value",t)}function Mp(t){if("string"!=typeof t)t=bp(t);else if(!vp(t)||t.length%2)return null;return(t.length-2)/2}function Ap(t,e,n){return"string"!=typeof t?t=bp(t):(!vp(t)||t.length%2)&&up.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=n?"0x"+t.substring(e,2+2*n):"0x"+t.substring(e)}function Np(t){let e="0x";return t.forEach((t=>{e+=bp(t).substring(2)})),e}function Ip(t){const e=function(t){"string"!=typeof t&&(t=bp(t)),vp(t)||up.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&up.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function xp(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(hp(t)){let n=pp(t);64===n.length?(e.v=27+(n[32]>>7),n[32]&=127,e.r=bp(n.slice(0,32)),e.s=bp(n.slice(32,64))):65===n.length?(e.r=bp(n.slice(0,32)),e.s=bp(n.slice(32,64)),e.v=n[64]):up.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:up.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(n[32]|=128),e._vs=bp(n.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const n=gp(pp(e._vs),32);e._vs=bp(n);const r=n[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=r:e.recoveryParam!==r&&up.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;const i=bp(n);null==e.s?e.s=i:e.s!==i&&up.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?up.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const n=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==n&&up.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&vp(e.r)?e.r=Ep(e.r,32):up.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&vp(e.s)?e.s=Ep(e.s,32):up.throwArgumentError("signature missing or invalid s","signature",t);const n=pp(e.s);n[0]>=128&&up.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(n[0]|=128);const r=bp(n);e._vs&&(vp(e._vs)||up.throwArgumentError("signature invalid _vs","signature",t),e._vs=Ep(e._vs,32)),null==e._vs?e._vs=r:e._vs!==r&&up.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const kp="bignumber/5.7.0";var Tp=Xf.BN;const Lp=new sp(kp),Sp={},jp=9007199254740991;let Cp=!1;class Dp{constructor(t,e){t!==Sp&&Lp.throwError("cannot call constructor directly; use BigNumber.from",sp.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return zp(Pp(this).fromTwos(t))}toTwos(t){return zp(Pp(this).toTwos(t))}abs(){return"-"===this._hex[0]?Dp.from(this._hex.substring(1)):this}add(t){return zp(Pp(this).add(Pp(t)))}sub(t){return zp(Pp(this).sub(Pp(t)))}div(t){return Dp.from(t).isZero()&&_p("division-by-zero","div"),zp(Pp(this).div(Pp(t)))}mul(t){return zp(Pp(this).mul(Pp(t)))}mod(t){const e=Pp(t);return e.isNeg()&&_p("division-by-zero","mod"),zp(Pp(this).umod(e))}pow(t){const e=Pp(t);return e.isNeg()&&_p("negative-power","pow"),zp(Pp(this).pow(e))}and(t){const e=Pp(t);return(this.isNegative()||e.isNeg())&&_p("unbound-bitwise-result","and"),zp(Pp(this).and(e))}or(t){const e=Pp(t);return(this.isNegative()||e.isNeg())&&_p("unbound-bitwise-result","or"),zp(Pp(this).or(e))}xor(t){const e=Pp(t);return(this.isNegative()||e.isNeg())&&_p("unbound-bitwise-result","xor"),zp(Pp(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&_p("negative-width","mask"),zp(Pp(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&_p("negative-width","shl"),zp(Pp(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&_p("negative-width","shr"),zp(Pp(this).shrn(t))}eq(t){return Pp(this).eq(Pp(t))}lt(t){return Pp(this).lt(Pp(t))}lte(t){return Pp(this).lte(Pp(t))}gt(t){return Pp(this).gt(Pp(t))}gte(t){return Pp(this).gte(Pp(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Pp(this).isZero()}toNumber(){try{return Pp(this).toNumber()}catch(t){_p("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Lp.throwError("this platform does not support BigInt",sp.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Cp||(Cp=!0,Lp.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Lp.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",sp.errors.UNEXPECTED_ARGUMENT,{}):Lp.throwError("BigNumber.toString does not accept parameters",sp.errors.UNEXPECTED_ARGUMENT,{})),Pp(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Dp)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Dp(Sp,Op(t)):t.match(/^-?[0-9]+$/)?new Dp(Sp,Op(new Tp(t))):Lp.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&_p("underflow","BigNumber.from",t),(t>=jp||t<=-jp)&&_p("overflow","BigNumber.from",t),Dp.from(String(t));const e=t;if("bigint"==typeof e)return Dp.from(e.toString());if(fp(e))return Dp.from(bp(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Dp.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(vp(t)||"-"===t[0]&&vp(t.substring(1))))return Dp.from(t)}return Lp.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Op(t){if("string"!=typeof t)return Op(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Lp.throwArgumentError("invalid hex","value",t),"0x00"===(t=Op(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function zp(t){return Dp.from(Op(t))}function Pp(t){const e=Dp.from(t).toHexString();return"-"===e[0]?new Tp("-"+e.substring(3),16):new Tp(e.substring(2),16)}function _p(t,e,n){const r={fault:t,operation:e};return null!=n&&(r.value=n),Lp.throwError(t,sp.errors.NUMERIC_FAULT,r)}const Bp=new sp(kp),Rp={},Up=Dp.from(0),Qp=Dp.from(-1);function Yp(t,e,n,r){const i={fault:e,operation:n};return void 0!==r&&(i.value=r),Bp.throwError(t,sp.errors.NUMERIC_FAULT,i)}let Wp="0";for(;Wp.length<256;)Wp+=Wp;function Fp(t){if("number"!=typeof t)try{t=Dp.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+Wp.substring(0,t):Bp.throwArgumentError("invalid decimal size","decimals",t)}function Vp(t,e){null==e&&(e=0);const n=Fp(e),r=(t=Dp.from(t)).lt(Up);r&&(t=t.mul(Qp));let i=t.mod(n).toString();for(;i.length2&&Bp.throwArgumentError("too many decimal points","value",t);let o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>n.length-1&&Yp("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.lengthnull==t[e]?r:(typeof t[e]!==n&&Bp.throwArgumentError("invalid fixed format ("+e+" not "+n+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),n=i("width","number",n),r=i("decimals","number",r)}return n%8&&Bp.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),r>80&&Bp.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",r),new Gp(Rp,e,n,r)}}class qp{constructor(t,e,n,r){t!==Rp&&Bp.throwError("cannot use FixedNumber constructor; use FixedNumber.from",sp.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=e,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&Bp.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=Hp(this._value,this.format.decimals),n=Hp(t._value,t.format.decimals);return qp.fromValue(e.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=Hp(this._value,this.format.decimals),n=Hp(t._value,t.format.decimals);return qp.fromValue(e.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=Hp(this._value,this.format.decimals),n=Hp(t._value,t.format.decimals);return qp.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=Hp(this._value,this.format.decimals),n=Hp(t._value,t.format.decimals);return qp.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=qp.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(e=e.subUnsafe(Zp.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=qp.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(e=e.addUnsafe(Zp.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&Bp.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const n=qp.from("1"+Wp.substring(0,t),this.format),r=Jp.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(r).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){return null==t?this._hex:(t%8&&Bp.throwArgumentError("invalid byte width","width",t),Ep(Dp.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8))}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return qp.fromString(this._value,t)}static fromValue(t,e,n){return null!=n||null==e||function(t){return null!=t&&(Dp.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||vp(t)||"bigint"==typeof t||fp(t))}(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),qp.fromString(Vp(t,e),Gp.from(n))}static fromString(t,e){null==e&&(e="fixed");const n=Gp.from(e),r=Hp(t,n.decimals);!n.signed&&r.lt(Up)&&Yp("unsigned value cannot be negative","overflow","value",t);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=Ep(i,n.width/8));const o=Vp(r,n.decimals);return new qp(Rp,i,o,n)}static fromBytes(t,e){null==e&&(e="fixed");const n=Gp.from(e);if(pp(t).length>n.width/8)throw new Error("overflow");let r=Dp.from(t);n.signed&&(r=r.fromTwos(n.width));const i=r.toTwos((n.signed?0:1)+n.width).toHexString(),o=Vp(r,n.decimals);return new qp(Rp,i,o,n)}static from(t,e){if("string"==typeof t)return qp.fromString(t,e);if(fp(t))return qp.fromBytes(t,e);try{return qp.fromValue(t,0,e)}catch(t){if(t.code!==sp.errors.INVALID_ARGUMENT)throw t}return Bp.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const Zp=qp.from(1),Jp=qp.from("0.5"),Xp=new sp("properties/5.7.0");function Kp(t,e,n){Object.defineProperty(t,e,{enumerable:!0,value:n,writable:!1})}function $p(t,e){for(let n=0;n<32;n++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function ty(t){return function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const n=t[e];return Promise.resolve(n).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function ey(t){const e={};for(const n in t)e[n]=t[n];return e}const ny={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function ry(t){if(null==t||ny[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let n=0;noy(t))));if("object"==typeof t){const e={};for(const n in t){const r=t[n];void 0!==r&&Kp(e,n,oy(r))}return e}return Xp.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function oy(t){return iy(t)}class ay{constructor(t){for(const e in t)this[e]=oy(t[e])}}const sy="abi/5.7.0",uy=new sp(sy),cy={};let ly={calldata:!0,memory:!0,storage:!0},hy={calldata:!0,memory:!0};function dy(t,e){if("bytes"===t||"string"===t){if(ly[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&hy[e])return!0;return(ly[e]||"payable"===e)&&uy.throwArgumentError("invalid modifier","name",e),!1}function fy(t,e){for(let n in e)Kp(t,n,e[n])}const py=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),yy=new RegExp(/^(.*)\[([0-9]*)\]$/);class my{constructor(t,e){t!==cy&&uy.throwError("use fromString",sp.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),fy(this,e);let n=this.type.match(yy);fy(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:my.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=py.sighash),py[t]||uy.throwArgumentError("invalid format type","format",t),t===py.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==py.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===py.full?", ":",")+")"):e+=this.type,t!==py.sighash&&(!0===this.indexed&&(e+=" indexed"),t===py.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?my.fromString(t,e):my.fromObject(t)}static fromObject(t){return my.isParamType(t)?t:new my(cy,{name:t.name||null,type:ky(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(my.fromObject):null})}static fromString(t,e){return n=function(t,e){let n=t;function r(e){uy.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(t){let n={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(n.indexed=!1),n}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},a=o;for(let n=0;nmy.fromString(t,e)))}class vy{constructor(t,e){t!==cy&&uy.throwError("use a static from method",sp.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),fy(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return vy.isFragment(t)?t:"string"==typeof t?vy.fromString(t):vy.fromObject(t)}static fromObject(t){if(vy.isFragment(t))return t;switch(t.type){case"function":return Iy.fromObject(t);case"event":return wy.fromObject(t);case"constructor":return Ny.fromObject(t);case"error":return xy.fromObject(t);case"fallback":case"receive":return null}return uy.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?wy.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?Iy.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Ny.fromString(t.trim()):"error"===t.split(" ")[0]?xy.fromString(t.substring(5).trim()):uy.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class wy extends vy{format(t){if(t||(t=py.sighash),py[t]||uy.throwArgumentError("invalid format type","format",t),t===py.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==py.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===py.full?", ":",")+") ",t!==py.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?wy.fromString(t):wy.fromObject(t)}static fromObject(t){if(wy.isEventFragment(t))return t;"event"!==t.type&&uy.throwArgumentError("invalid event object","value",t);const e={name:Ly(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(my.fromObject):[],type:"event"};return new wy(cy,e)}static fromString(t){let e=t.match(Sy);e||uy.throwArgumentError("invalid event string","value",t);let n=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":n=!0;break;case"":break;default:uy.warn("unknown modifier: "+t)}})),wy.fromObject({name:e[1].trim(),anonymous:n,inputs:gy(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function by(t,e){e.gas=null;let n=t.split("@");return 1!==n.length?(n.length>2&&uy.throwArgumentError("invalid human-readable ABI signature","value",t),n[1].match(/^[0-9]+$/)||uy.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=Dp.from(n[1]),n[0]):t}function My(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function Ay(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&uy.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&uy.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||uy.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&uy.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&uy.throwArgumentError("unable to determine stateMutability","value",t),e}class Ny extends vy{format(t){if(t||(t=py.sighash),py[t]||uy.throwArgumentError("invalid format type","format",t),t===py.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===py.sighash&&uy.throwError("cannot format a constructor for sighash",sp.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===py.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Ny.fromString(t):Ny.fromObject(t)}static fromObject(t){if(Ny.isConstructorFragment(t))return t;"constructor"!==t.type&&uy.throwArgumentError("invalid constructor object","value",t);let e=Ay(t);e.constant&&uy.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(my.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?Dp.from(t.gas):null};return new Ny(cy,n)}static fromString(t){let e={type:"constructor"},n=(t=by(t,e)).match(Sy);return n&&"constructor"===n[1].trim()||uy.throwArgumentError("invalid constructor string","value",t),e.inputs=gy(n[2].trim(),!1),My(n[3].trim(),e),Ny.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class Iy extends Ny{format(t){if(t||(t=py.sighash),py[t]||uy.throwArgumentError("invalid format type","format",t),t===py.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==py.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===py.full?", ":",")+") ",t!==py.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?Iy.fromString(t):Iy.fromObject(t)}static fromObject(t){if(Iy.isFunctionFragment(t))return t;"function"!==t.type&&uy.throwArgumentError("invalid function object","value",t);let e=Ay(t);const n={type:t.type,name:Ly(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(my.fromObject):[],outputs:t.outputs?t.outputs.map(my.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?Dp.from(t.gas):null};return new Iy(cy,n)}static fromString(t){let e={type:"function"},n=(t=by(t,e)).split(" returns ");n.length>2&&uy.throwArgumentError("invalid function string","value",t);let r=n[0].match(Sy);if(r||uy.throwArgumentError("invalid function signature","value",t),e.name=r[1].trim(),e.name&&Ly(e.name),e.inputs=gy(r[2],!1),My(r[3].trim(),e),n.length>1){let r=n[1].match(Sy);""==r[1].trim()&&""==r[3].trim()||uy.throwArgumentError("unexpected tokens","value",t),e.outputs=gy(r[2],!1)}else e.outputs=[];return Iy.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function Ey(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||uy.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class xy extends vy{format(t){if(t||(t=py.sighash),py[t]||uy.throwArgumentError("invalid format type","format",t),t===py.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==py.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===py.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?xy.fromString(t):xy.fromObject(t)}static fromObject(t){if(xy.isErrorFragment(t))return t;"error"!==t.type&&uy.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:Ly(t.name),inputs:t.inputs?t.inputs.map(my.fromObject):[]};return Ey(new xy(cy,e))}static fromString(t){let e={type:"error"},n=t.match(Sy);return n||uy.throwArgumentError("invalid error signature","value",t),e.name=n[1].trim(),e.name&&Ly(e.name),e.inputs=gy(n[2],!1),Ey(xy.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function ky(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const Ty=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ly(t){return t&&t.match(Ty)||uy.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const Sy=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),jy=new sp(sy);class Cy{constructor(t,e,n,r){this.name=t,this.type=e,this.localName=n,this.dynamic=r}_throwError(t,e){jy.throwArgumentError(t,this.localName,e)}}class Dy{constructor(t){Kp(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return Np(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(yp(t._data))}writeBytes(t){let e=pp(t);const n=e.length%this.wordSize;return n&&(e=yp([e,this._padding.slice(n)])),this._writeData(e)}_getValue(t){let e=pp(Dp.from(t));return e.length>this.wordSize&&jy.throwError("value out-of-bounds",sp.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=yp([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class Oy{constructor(t,e,n,r){Kp(this,"_data",pp(t)),Kp(this,"wordSize",e||32),Kp(this,"_coerceFunc",n),Kp(this,"allowLoose",r),this._offset=0}get data(){return bp(this._data)}get consumed(){return this._offset}static coerce(t,e){let n=t.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):Oy.coerce(t,e)}_peekBytes(t,e,n){let r=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&(this.allowLoose&&n&&this._offset+e<=this._data.length?r=e:jy.throwError("data out-of-bounds",sp.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r})),this._data.slice(this._offset,this._offset+r)}subReader(t){return new Oy(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let n=this._peekBytes(0,t,!!e);return this._offset+=n.length,n.slice(0,t)}readValue(){return Dp.from(this.readBytes(this.wordSize))}}var zy=_f((function(t){!function(){var e="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof k&&k.versions&&k.versions.node?r=Pf:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&t.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),u=[4,1024,262144,67108864],c=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],d=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var y=function(t,e,n){return function(r){return new j(t,e,t).update(r)[n]()}},m=function(t,e,n){return function(r,i){return new j(t,e,i).update(r)[n]()}},g=function(t,e,n){return function(e,r,i,o){return A["cshake"+t].update(e,r,i,o)[n]()}},v=function(t,e,n){return function(e,r,i,o){return A["kmac"+t].update(e,r,i,o)[n]()}},w=function(t,e,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function C(t,e,n){j.call(this,t,e,n)}j.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}for(var i,o,s=this.blocks,u=this.byteCount,l=t.length,h=this.blockCount,d=0,f=this.s;d>2]|=t[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(s[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=u){for(this.start=i-u,this.block=s[h],i=0;i>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},j.prototype.encodeString=function(t){var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}var i=0,o=t.length;if(n)i=o;else for(var s=0;s=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},j.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e>4&15]+s[15&t]+s[t>>12&15]+s[t>>8&15]+s[t>>20&15]+s[t>>16&15]+s[t>>28&15]+s[t>>24&15];a%e==0&&(D(n),o=0)}return i&&(t=n[o],u+=s[t>>4&15]+s[15&t],i>1&&(u+=s[t>>12&15]+s[t>>8&15]),i>2&&(u+=s[t>>20&15]+s[t>>16&15])),u},j.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&D(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},C.prototype=new j,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),j.prototype.finalize.call(this)};var D=function(t){var e,n,r,i,o,a,s,u,c,h,d,f,p,y,m,g,v,w,b,M,A,N,I,E,x,k,T,L,S,j,C,D,O,z,P,_,B,R,U,Q,Y,W,F,V,H,G,q,Z,J,X,K,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(h<<1|d>>>31),n=s^(d<<1|h>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=h^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,y=t[0],m=t[1],G=t[11]<<4|t[10]>>>28,q=t[10]<<4|t[11]>>>28,L=t[20]<<3|t[21]>>>29,S=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,W=t[40]<<18|t[41]>>>14,F=t[41]<<18|t[40]>>>14,z=t[2]<<1|t[3]>>>31,P=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,Z=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,j=t[33]<<13|t[32]>>>19,C=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,_=t[14]<<6|t[15]>>>26,B=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,K=t[35]<<15|t[34]>>>17,D=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,E=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,R=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,H=t[9]<<27|t[8]>>>5,k=t[18]<<20|t[19]>>>12,T=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,Q=t[38]<<8|t[39]>>>24,Y=t[39]<<8|t[38]>>>24,N=t[48]<<14|t[49]>>>18,I=t[49]<<14|t[48]>>>18,t[0]=y^~g&w,t[1]=m^~v&b,t[10]=E^~k&L,t[11]=x^~T&S,t[20]=z^~_&R,t[21]=P^~B&U,t[30]=V^~G&Z,t[31]=H^~q&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=g^~w&M,t[3]=v^~b&A,t[12]=k^~L&j,t[13]=T^~S&C,t[22]=_^~R&Q,t[23]=B^~U&Y,t[32]=G^~Z&X,t[33]=q^~J&K,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=w^~M&N,t[5]=b^~A&I,t[14]=L^~j&D,t[15]=S^~C&O,t[24]=R^~Q&W,t[25]=U^~Y&F,t[34]=Z^~X&$,t[35]=J^~K&tt,t[44]=ot^~st&ct,t[45]=at^~ut<,t[6]=M^~N&y,t[7]=A^~I&m,t[16]=j^~D&E,t[17]=C^~O&x,t[26]=Q^~W&z,t[27]=Y^~F&P,t[36]=X^~$&V,t[37]=K^~tt&H,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=N^~y&g,t[9]=I^~m&v,t[18]=D^~E&k,t[19]=O^~x&T,t[28]=W^~z&_,t[29]=F^~P&B,t[38]=$^~V&G,t[39]=tt^~H&q,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=l[r],t[1]^=l[r+1]};if(o)t.exports=A;else for(I=0;I>=8;return e}function Ry(t,e,n){let r=0;for(let i=0;ie+1+r&&_y.throwError("child data too short",sp.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function Wy(t,e){if(0===t.length&&_y.throwError("data too short",sp.errors.BUFFER_OVERRUN,{}),t[e]>=248){const n=t[e]-247;e+1+n>t.length&&_y.throwError("data short segment too short",sp.errors.BUFFER_OVERRUN,{});const r=Ry(t,e+1,n);return e+1+n+r>t.length&&_y.throwError("data long segment too short",sp.errors.BUFFER_OVERRUN,{}),Yy(t,e,e+1+n,n+r)}if(t[e]>=192){const n=t[e]-192;return e+1+n>t.length&&_y.throwError("data array too short",sp.errors.BUFFER_OVERRUN,{}),Yy(t,e,e+1,n)}if(t[e]>=184){const n=t[e]-183;e+1+n>t.length&&_y.throwError("data array too short",sp.errors.BUFFER_OVERRUN,{});const r=Ry(t,e+1,n);return e+1+n+r>t.length&&_y.throwError("data array too short",sp.errors.BUFFER_OVERRUN,{}),{consumed:1+n+r,result:bp(t.slice(e+1+n,e+1+n+r))}}if(t[e]>=128){const n=t[e]-128;return e+1+n>t.length&&_y.throwError("data too short",sp.errors.BUFFER_OVERRUN,{}),{consumed:1+n,result:bp(t.slice(e+1,e+1+n))}}return{consumed:1,result:bp(t[e])}}function Fy(t){const e=pp(t),n=Wy(e,0);return n.consumed!==e.length&&_y.throwArgumentError("invalid rlp data","data",t),n.result}const Vy=new sp("address/5.7.0");function Hy(t){vp(t,20)||Vy.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let t=0;t<40;t++)n[t]=e[t].charCodeAt(0);const r=pp(Py(n));for(let t=0;t<40;t+=2)r[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&r[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Gy={};for(let t=0;t<10;t++)Gy[String(t)]=String(t);for(let t=0;t<26;t++)Gy[String.fromCharCode(65+t)]=String(10+t);const qy=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Zy(t){let e=null;if("string"!=typeof t&&Vy.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Hy(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Vy.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Gy[t])).join("");for(;e.length>=qy;){let t=e.substring(0,qy);e=parseInt(t,10)%97+e.substring(t.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}(t)&&Vy.throwArgumentError("bad icap checksum","address",t),n=t.substring(4),e=new Tp(n,36).toString(16);e.length<40;)e="0"+e;e=Hy("0x"+e)}else Vy.throwArgumentError("invalid address","address",t);var n;return e}function Jy(t){let e=null;try{e=Zy(t.from)}catch(e){Vy.throwArgumentError("missing from address","transaction",t)}return Zy(Ap(Py(Qy([e,mp(pp(Dp.from(t.nonce).toHexString()))])),12))}class Xy extends Cy{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=Zy(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return Zy(Ep(t.readValue().toHexString(),20))}}class Ky extends Cy{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const $y=new sp(sy);function tm(t,e,n){let r=null;if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let t={};r=e.map((e=>{const r=e.localName;return r||$y.throwError("cannot encode object for signature with missing names",sp.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[r]&&$y.throwError("cannot encode object for signature with duplicate names",sp.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[r]=!0,n[r]}))}else $y.throwArgumentError("invalid tuple value","tuple",n);e.length!==r.length&&$y.throwArgumentError("types/value length mismatch","tuple",n);let i=new Dy(t.wordSize),o=new Dy(t.wordSize),a=[];e.forEach(((t,e)=>{let n=r[e];if(t.dynamic){let e=o.length;t.encode(o,n);let r=i.writeUpdatableValue();a.push((t=>{r(t+e)}))}else t.encode(i,n)})),a.forEach((t=>{t(i.length)}));let s=t.appendWriter(i);return s+=t.appendWriter(o),s}function em(t,e){let n=[],r=t.subReader(0);e.forEach((e=>{let i=null;if(e.dynamic){let n=t.readValue(),o=r.subReader(n.toNumber());try{i=e.decode(o)}catch(t){if(t.code===sp.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===sp.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&n.push(i)}));const i=e.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});e.forEach(((t,e)=>{let r=t.localName;if(!r||1!==i[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const o=n[e];o instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw o}}):n[r]=o}));for(let t=0;t{throw e}})}return Object.freeze(n)}class nm extends Cy{constructor(t,e,n){super("array",t.type+"["+(e>=0?e:"")+"]",n,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let n=0;nt._data.length&&$y.throwError("insufficient data length",sp.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let n=[];for(let t=0;t>6==2;r++)t++;return t}return t===ym.OVERRUN?n.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(pm||(pm={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(ym||(ym={}));const gm=Object.freeze({error:function(t,e,n,r,i){return fm.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",n)},ignore:mm,replace:function(t,e,n,r,i){return t===ym.OVERLONG?(r.push(i),0):(r.push(65533),mm(t,e,n))}});function vm(t,e){null==e&&(e=gm.error),t=pp(t);const n=[];let r=0;for(;r>7==0){n.push(i);continue}let o=null,a=null;if(192==(224&i))o=1,a=127;else if(224==(240&i))o=2,a=2047;else{if(240!=(248&i)){r+=e(128==(192&i)?ym.UNEXPECTED_CONTINUE:ym.BAD_PREFIX,r-1,t,n);continue}o=3,a=65535}if(r-1+o>=t.length){r+=e(ym.OVERRUN,r-1,t,n);continue}let s=i&(1<<8-o-1)-1;for(let i=0;i1114111?r+=e(ym.OUT_OF_RANGE,r-1-o,t,n,s):s>=55296&&s<=57343?r+=e(ym.UTF16_SURROGATE,r-1-o,t,n,s):s<=a?r+=e(ym.OVERLONG,r-1-o,t,n,s):n.push(s))}return n}function wm(t,e=pm.current){e!=pm.current&&(fm.checkNormalize(),t=t.normalize(e));let n=[];for(let e=0;e>6|192),n.push(63&r|128);else if(55296==(64512&r)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&r)<<10)+(1023&i);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return pp(n)}function bm(t,e){return vm(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}class Mm extends im{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,wm(e))}decode(t){return bm(super.decode(t))}}class Am extends Cy{constructor(t,e){let n=!1;const r=[];t.forEach((t=>{t.dynamic&&(n=!0),r.push(t.type)})),super("tuple","tuple("+r.join(",")+")",e,n),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});return this.coders.forEach(((n,r)=>{let i=n.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[r]))})),Object.freeze(t)}encode(t,e){return tm(t,this.coders,e)}decode(t){return t.coerce(this.name,em(t,this.coders))}}const Nm=new sp(sy),Im=new RegExp(/^bytes([0-9]*)$/),Em=new RegExp(/^(u?int)([0-9]*)$/),xm=new class{constructor(t){Kp(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new Xy(t.name);case"bool":return new rm(t.name);case"string":return new Mm(t.name);case"bytes":return new om(t.name);case"array":return new nm(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new Am((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new sm(t.name)}let e=t.type.match(Em);if(e){let n=parseInt(e[2]||"256");return(0===n||n>256||n%8!=0)&&Nm.throwArgumentError("invalid "+e[1]+" bit length","param",t),new dm(n/8,"int"===e[1],t.name)}if(e=t.type.match(Im),e){let n=parseInt(e[1]);return(0===n||n>32)&&Nm.throwArgumentError("invalid bytes length","param",t),new am(n,t.name)}return Nm.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new Oy(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new Dy(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(my.from(t))));return new Am(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&Nm.throwError("types/values length mismatch",sp.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const n=t.map((t=>this._getCoder(my.from(t)))),r=new Am(n,"_"),i=this._getWriter();return r.encode(i,e),i.data}decode(t,e,n){const r=t.map((t=>this._getCoder(my.from(t))));return new Am(r,"_").decode(this._getReader(pp(e),n))}};function km(t){return Py(wm(t))}const Tm="hash/5.7.0";function Lm(t){t=atob(t);const e=[];for(let n=0;n0&&Array.isArray(t)?i(t,e-1):n.push(t)}))};return i(t,e),n}function Cm(t){return 1&t?~t>>1:t>>1}function Dm(t,e){let n=Array(t);for(let r=0,i=-1;re[t])):n}function Pm(t,e,n){let r=Array(t).fill(void 0).map((()=>[]));for(let i=0;ir[e].push(t)));return r}function _m(t,e){let n=1+e(),r=e(),i=function(t){let e=[];for(;;){let n=t();if(0==n)break;e.push(n)}return e}(e);return jm(Pm(i.length,1+t,e).map(((t,e)=>{const o=t[0],a=t.slice(1);return Array(i[e]).fill(void 0).map(((t,e)=>{let i=e*r;return[o+e*n,a.map((t=>t+i))]}))})))}function Bm(t,e){return Pm(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}const Rm=function(t){return function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),i=1,o=[0,1];for(let t=1;t>--u&1}const h=Math.pow(2,31),d=h>>>1,f=d>>1,p=h-1;let y=0;for(let t=0;t<31;t++)y=y<<1|l();let m=[],g=0,v=h;for(;;){let t=Math.floor(((y-g+1)*i-1)/v),e=0,n=r;for(;n-e>1;){let r=e+n>>>1;t>>1|l(),a=a<<1^d,s=(s^d)<<1|d|1;g=a,v=1+s-a}let w=r-4;return m.map((e=>{switch(e-w){case 3:return w+65792+(t[s++]<<16|t[s++]<<8|t[s++]);case 2:return w+256+(t[s++]<<8|t[s++]);case 1:return w+t[s++];default:return e-1}}))}(t))}(Lm("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),Um=new Set(zm(Rm)),Qm=new Set(zm(Rm)),Ym=function(t){let e=[];for(;;){let n=t();if(0==n)break;e.push(_m(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(Bm(n,t))}return function(t){const e={};for(let n=0;nt-e));return function n(){let r=[];for(;;){let i=zm(t,e);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort(((t,e)=>e.set.size-t.set.size));let i=t(),o=i%3;i=i/3|0;let a=!!(1&i);return i>>=1,{branches:r,valid:o,fe0f:a,save:1==i,check:2==i}}()}(Rm);function Fm(t){return function(t,e=pm.current){return vm(wm(t,e))}(t)}function Vm(t){return t.filter((t=>65039!=t))}function Hm(t){for(let e of t.split(".")){let n=Fm(e);try{for(let t=n.lastIndexOf(95)-1;t>=0;t--)if(95!==n[t])throw new Error("underscore only allowed at start");if(n.length>=4&&n.every((t=>t<128))&&45===n[2]&&45===n[3])throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${e}": ${t.message}`)}}return t}function Gm(t,e){var n;let r,i,o=Wm,a=[],s=t.length;for(e&&(e.length=0);s;){let u=t[--s];if(o=null===(n=o.branches.find((t=>t.set.has(u))))||void 0===n?void 0:n.node,!o)break;if(o.save)i=u;else if(o.check&&u===i)break;a.push(u),o.fe0f&&(a.push(65039),s>0&&65039==t[s-1]&&s--),o.valid&&(r=a.slice(),2==o.valid&&r.splice(1,1),e&&e.push(...t.slice(s).reverse()),t.length=s)}return r}const qm=new sp(Tm),Zm=new Uint8Array(32);function Jm(t){if(0===t.length)throw new Error("invalid ENS name; empty component");return t}function Xm(t){const e=wm(function(t){return Hm(function(t,e){let n=Fm(t).reverse(),r=[];for(;n.length;){let t=Gm(n);if(t){r.push(...e(t));continue}let i=n.pop();if(Um.has(i)){r.push(i);continue}if(Qm.has(i))continue;let o=Ym[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);r.push(...o)}return Hm(function(t){return t.normalize("NFC")}(String.fromCodePoint(...r)))}(t,Vm))}(t)),n=[];if(0===t.length)return n;let r=0;for(let t=0;t=e.length)throw new Error("invalid ENS name; empty component");return n.push(Jm(e.slice(r))),n}function Km(t){"string"!=typeof t&&qm.throwArgumentError("invalid ENS name; not a string","name",t);let e=Zm;const n=Xm(t);for(;n.length;)e=Py(yp([e,Py(n.pop())]));return bp(e)}Zm.fill(0);const $m=new sp(Tm),tg=new Uint8Array(32);tg.fill(0);const eg=Dp.from(-1),ng=Dp.from(0),rg=Dp.from(1),ig=Dp.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),og=Ep(rg.toHexString(),32),ag=Ep(ng.toHexString(),32),sg={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},ug=["name","version","chainId","verifyingContract","salt"];function cg(t){return function(e){return"string"!=typeof e&&$m.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const lg={name:cg("name"),version:cg("version"),chainId:function(t){try{return Dp.from(t).toString()}catch(t){}return $m.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return Zy(t).toLowerCase()}catch(t){}return $m.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=pp(t);if(32!==e.length)throw new Error("bad length");return bp(e)}catch(t){}return $m.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function hg(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const n=""===e[1],r=parseInt(e[2]||"256");(r%8!=0||r>256||e[2]&&e[2]!==String(r))&&$m.throwArgumentError("invalid numeric width","type",t);const i=ig.mask(n?r-1:r),o=n?i.add(rg).mul(eg):ng;return function(e){const n=Dp.from(e);return(n.lt(o)||n.gt(i))&&$m.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),Ep(n.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return(0===n||n>32||e[1]!==String(n))&&$m.throwArgumentError("invalid bytes width","type",t),function(e){return pp(e).length!==n&&$m.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=pp(t),n=e.length%32;return n?Np([e,tg.slice(n)]):bp(e)}(e)}}}switch(t){case"address":return function(t){return Ep(Zy(t),32)};case"bool":return function(t){return t?og:ag};case"bytes":return function(t){return Py(t)};case"string":return function(t){return km(t)}}return null}function dg(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class fg{constructor(t){Kp(this,"types",Object.freeze(oy(t))),Kp(this,"_encoderCache",{}),Kp(this,"_types",{});const e={},n={},r={};Object.keys(t).forEach((t=>{e[t]={},n[t]=[],r[t]={}}));for(const r in t){const i={};t[r].forEach((o=>{i[o.name]&&$m.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(r)}`,"types",t),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===r&&$m.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t),hg(a)||(n[a]||$m.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",t),n[a].push(r),e[r][a]=!0)}))}const i=Object.keys(n).filter((t=>0===n[t].length));0===i.length?$m.throwArgumentError("missing primary type","types",t):i.length>1&&$m.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),Kp(this,"primaryType",i[0]),function i(o,a){a[o]&&$m.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),a[o]=!0,Object.keys(e[o]).forEach((t=>{n[t]&&(i(t,a),Object.keys(a).forEach((e=>{r[e][t]=!0})))})),delete a[o]}(this.primaryType,{});for(const e in r){const n=Object.keys(r[e]);n.sort(),this._types[e]=dg(e,t[e])+n.map((e=>dg(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=hg(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],n=this.getEncoder(t),r=parseInt(e[3]);return e=>{r>=0&&e.length!==r&&$m.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(n);return this._types[t]&&(i=i.map(Py)),Py(Np(i))}}const n=this.types[t];if(n){const e=km(this._types[t]);return t=>{const r=n.map((({name:e,type:n})=>{const r=this.getEncoder(n)(t[e]);return this._types[n]?Py(r):r}));return r.unshift(e),Np(r)}}return $m.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||$m.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return Py(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,n){if(hg(t))return n(t,e);const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const t=r[1],i=parseInt(r[3]);return i>=0&&e.length!==i&&$m.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,n)))}const i=this.types[t];return i?i.reduce(((t,{name:r,type:i})=>(t[r]=this._visit(i,e[r],n),t)),{}):$m.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new fg(t)}static getPrimaryType(t){return fg.from(t).primaryType}static hashStruct(t,e,n){return fg.from(e).hashStruct(t,n)}static hashDomain(t){const e=[];for(const n in t){const r=sg[n];r||$m.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),e.push({name:n,type:r})}return e.sort(((t,e)=>ug.indexOf(t.name)-ug.indexOf(e.name))),fg.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,n){return Np(["0x1901",fg.hashDomain(t),fg.from(e).hash(n)])}static hash(t,e,n){return Py(fg.encode(t,e,n))}static resolveNames(t,e,n,r){return function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}(this,void 0,void 0,(function*(){t=ey(t);const i={};t.verifyingContract&&!vp(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=fg.from(e);o.visit(n,((t,e)=>("address"!==t||vp(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield r(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),n=o.visit(n,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:n}}))}static getPayload(t,e,n){fg.hashDomain(t);const r={},i=[];ug.forEach((e=>{const n=t[e];null!=n&&(r[e]=lg[e](n),i.push({name:e,type:sg[e]}))}));const o=fg.from(e),a=ey(e);return a.EIP712Domain?$m.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):a.EIP712Domain=i,o.encode(n),{types:a,domain:r,primaryType:o.primaryType,message:o.visit(n,((t,e)=>{if(t.match(/^bytes(\d*)/))return bp(pp(e));if(t.match(/^u?int/))return Dp.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&$m.throwArgumentError("invalid string","value",e),e}return $m.throwArgumentError("unsupported type","type",t)}))}}}const pg=new sp(sy);class yg extends ay{}class mg extends ay{}class gg extends ay{}class vg extends ay{static isIndexed(t){return!(!t||!t._isIndexed)}}const wg={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function bg(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return n.error=e,n}class Mg{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,Kp(this,"fragments",e.map((t=>vy.from(t))).filter((t=>null!=t))),Kp(this,"_abiCoder",$p(new.target,"getAbiCoder")()),Kp(this,"functions",{}),Kp(this,"errors",{}),Kp(this,"events",{}),Kp(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void pg.warn("duplicate definition - constructor"):void Kp(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let n=t.format();e[n]?pg.warn("duplicate definition - "+n):e[n]=t})),this.deploy||Kp(this,"deploy",Ny.from({payable:!1,type:"constructor"})),Kp(this,"_isInterface",!0)}format(t){t||(t=py.full),t===py.sighash&&pg.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===py.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return xm}static getAddress(t){return Zy(t)}static getSighash(t){return Ap(km(t.format()),0,4)}static getEventTopic(t){return km(t.format())}getFunction(t){if(vp(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];pg.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===n.length?pg.throwArgumentError("no matching function","name",e):n.length>1&&pg.throwArgumentError("multiple matching functions","name",e),this.functions[n[0]]}const e=this.functions[Iy.fromString(t).format()];return e||pg.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(vp(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];pg.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===n.length?pg.throwArgumentError("no matching event","name",e):n.length>1&&pg.throwArgumentError("multiple matching events","name",e),this.events[n[0]]}const e=this.events[wy.fromString(t).format()];return e||pg.throwArgumentError("no matching event","signature",t),e}getError(t){if(vp(t)){const e=$p(this.constructor,"getSighash");for(const n in this.errors)if(t===e(this.errors[n]))return this.errors[n];pg.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===n.length?pg.throwArgumentError("no matching error","name",e):n.length>1&&pg.throwArgumentError("multiple matching errors","name",e),this.errors[n[0]]}const e=this.errors[Iy.fromString(t).format()];return e||pg.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return $p(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),$p(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const n=pp(e);return bp(n.slice(0,4))!==this.getSighash(t)&&pg.throwArgumentError(`data signature does not match error ${t.name}.`,"data",bp(n)),this._decodeParams(t.inputs,n.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),bp(yp([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const n=pp(e);return bp(n.slice(0,4))!==this.getSighash(t)&&pg.throwArgumentError(`data signature does not match function ${t.name}.`,"data",bp(n)),this._decodeParams(t.inputs,n.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),bp(yp([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let n=pp(e),r=null,i="",o=null,a=null,s=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,n)}catch(t){}break;case 4:{const e=bp(n.slice(0,4)),u=wg[e];if(u)o=this._abiCoder.decode(u.inputs,n.slice(4)),a=u.name,s=u.signature,u.reason&&(r=o[0]),"Error"===a?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===a&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const t=this.getError(e);o=this._abiCoder.decode(t.inputs,n.slice(4)),a=t.name,s=t.format()}catch(t){}break}}return pg.throwError("call revert exception"+i,sp.errors.CALL_EXCEPTION,{method:t.format(),data:bp(e),errorArgs:o,errorName:a,errorSignature:s,reason:r})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),bp(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&pg.throwError("too many arguments for "+t.format(),sp.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let n=[];t.anonymous||n.push(this.getEventTopic(t));const r=(t,e)=>"string"===t.type?km(e):"bytes"===t.type?Py(bp(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=Dp.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),Ep(bp(e),32));for(e.forEach(((e,i)=>{let o=t.inputs[i];o.indexed?null==e?n.push(null):"array"===o.baseType||"tuple"===o.baseType?pg.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?n.push(e.map((t=>r(o,t)))):n.push(r(o,e)):null!=e&&pg.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const n=[],r=[],i=[];return t.anonymous||n.push(this.getEventTopic(t)),e.length!==t.inputs.length&&pg.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const a=e[o];if(t.indexed)if("string"===t.type)n.push(km(a));else if("bytes"===t.type)n.push(Py(a));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");n.push(this._abiCoder.encode([t.type],[a]))}else r.push(t),i.push(a)})),{data:this._abiCoder.encode(r,i),topics:n}}decodeEventLog(t,e,n){if("string"==typeof t&&(t=this.getEvent(t)),null!=n&&!t.anonymous){let e=this.getEventTopic(t);vp(n[0],32)&&n[0].toLowerCase()===e||pg.throwError("fragment/topic mismatch",sp.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:n[0]}),n=n.slice(1)}let r=[],i=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(r.push(my.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(r.push(t),o.push(!1)):(i.push(t),o.push(!1))}));let a=null!=n?this._abiCoder.decode(r,yp(n)):null,s=this._abiCoder.decode(i,e,!0),u=[],c=0,l=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==a)u[e]=new vg({_isIndexed:!0,hash:null});else if(o[e])u[e]=new vg({_isIndexed:!0,hash:a[l++]});else try{u[e]=a[l++]}catch(t){u[e]=t}else try{u[e]=s[c++]}catch(t){u[e]=t}if(t.name&&null==u[t.name]){const n=u[e];n instanceof Error?Object.defineProperty(u,t.name,{enumerable:!0,get:()=>{throw bg(`property ${JSON.stringify(t.name)}`,n)}}):u[t.name]=n}}));for(let t=0;t{throw bg(`index ${t}`,e)}})}return Object.freeze(u)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new mg({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:Dp.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new yg({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=bp(t);let n=this.getError(e.substring(0,10).toLowerCase());return n?new gg({args:this._abiCoder.decode(n.inputs,"0x"+e.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(t){return!(!t||!t._isInterface)}}const Ag=new sp("abstract-provider/5.7.0");class Ng extends ay{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class Ig{constructor(){Ag.checkAbstract(new.target,Ig),Kp(this,"_isProvider",!0)}getFeeData(){return function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}(this,void 0,void 0,(function*(){const{block:t,gasPrice:e}=yield ty({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((t=>null))});let n=null,r=null,i=null;return t&&t.baseFeePerGas&&(n=t.baseFeePerGas,i=Dp.from("1500000000"),r=t.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:n,maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:e}}))}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}var Eg=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const xg=new sp("abstract-signer/5.7.0"),kg=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],Tg=[sp.errors.INSUFFICIENT_FUNDS,sp.errors.NONCE_EXPIRED,sp.errors.REPLACEMENT_UNDERPRICED];class Lg{constructor(){xg.checkAbstract(new.target,Lg),Kp(this,"_isSigner",!0)}getBalance(t){return Eg(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return Eg(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return Eg(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield ty(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return Eg(this,void 0,void 0,(function*(){this._checkProvider("call");const n=yield ty(this.checkTransaction(t));return yield this.provider.call(n,e)}))}sendTransaction(t){return Eg(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),n=yield this.signTransaction(e);return yield this.provider.sendTransaction(n)}))}getChainId(){return Eg(this,void 0,void 0,(function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return Eg(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return Eg(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return Eg(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===kg.indexOf(e)&&xg.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=ey(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&xg.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return Eg(this,void 0,void 0,(function*(){const e=yield ty(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>Eg(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&xg.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const n=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!n?0!==e.type&&1!==e.type||!n||xg.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):xg.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(n&&xg.throwError("network does not support EIP-1559",sp.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):xg.throwError("failed to get consistent fee data",sp.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(Tg.indexOf(t.code)>=0)throw t;return xg.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",sp.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&xg.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield ty(e)}))}_checkProvider(t){this.provider||xg.throwError("missing provider",sp.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class Sg extends Lg{constructor(t,e){super(),Kp(this,"address",t),Kp(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{xg.throwError(t,sp.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new Sg(this.address,t)}}var jg=_f((function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Jf.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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 p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}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 r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.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;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 I(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){I.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return v[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,I),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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,Pf)})),Cg=Dg;function Dg(t,e){if(!t)throw new Error(e||"Assertion failed")}Dg.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var Og=[],zg=[],Pg="undefined"!=typeof Uint8Array?Uint8Array:Array,_g=!1;function Bg(){_g=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,n=t.length;e>18&63]+Og[i>>12&63]+Og[i>>6&63]+Og[63&i]);return o.join("")}function Ug(t){var e;_g||Bg();for(var n=t.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;su?u:s+a));return 1===r?(e=t[n-1],i+=Og[e>>2],i+=Og[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=Og[e>>10],i+=Og[e>>4&63],i+=Og[e<<2&63],i+="="),o.push(i),o.join("")}function Qg(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)}function Yg(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;t[n+f]=255&a,f+=p,a/=256,c-=8);t[n+f-p]|=128*y}var Wg={}.toString,Fg=Array.isArray||function(t){return"[object Array]"==Wg.call(t)};function Vg(){return Gg.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Hg(t,e){if(Vg()=Vg())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Vg().toString(16)+" bytes");return 0|t}function $g(t){return!(null==t||!t._isBuffer)}function tv(t,e){if($g(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return kv(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Tv(t).length;default:if(r)return kv(t).length;e=(""+e).toLowerCase(),r=!0}}function ev(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return mv(this,e,n);case"utf8":case"utf-8":return dv(this,e,n);case"ascii":return pv(this,e,n);case"latin1":case"binary":return yv(this,e,n);case"base64":return hv(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gv(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function nv(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function rv(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=Gg.from(e,r)),$g(e))return 0===e.length?-1:iv(t,e,n,r,i);if("number"==typeof e)return e&=255,Gg.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):iv(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function iv(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function hv(t,e,n){return 0===e&&n===t.length?Ug(t):Ug(t.slice(e,n))}function dv(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(t){var e=t.length;if(e<=fv)return String.fromCharCode.apply(String,t);for(var n="",r=0;r0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},Gg.prototype.compare=function(t,e,n,r,i){if(!$g(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(r,i),c=t.slice(e,n),l=0;li)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return ov(this,t,e,n);case"utf8":case"utf-8":return av(this,t,e,n);case"ascii":return sv(this,t,e,n);case"latin1":case"binary":return uv(this,t,e,n);case"base64":return cv(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lv(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},Gg.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var fv=4096;function pv(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;ir)&&(n=r);for(var i="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function wv(t,e,n,r,i,o){if(!$g(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function bv(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i>>8*(r?i:1-i)}function Mv(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i>>8*(r?i:3-i)&255}function Av(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Nv(t,e,n,r,i){return i||Av(t,0,n,4),Yg(t,e,n,r,23,4),n+4}function Iv(t,e,n,r,i){return i||Av(t,0,n,8),Yg(t,e,n,r,52,8),n+8}Gg.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),e0&&(i*=256);)r+=this[t+--e]*i;return r},Gg.prototype.readUInt8=function(t,e){return e||vv(t,1,this.length),this[t]},Gg.prototype.readUInt16LE=function(t,e){return e||vv(t,2,this.length),this[t]|this[t+1]<<8},Gg.prototype.readUInt16BE=function(t,e){return e||vv(t,2,this.length),this[t]<<8|this[t+1]},Gg.prototype.readUInt32LE=function(t,e){return e||vv(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Gg.prototype.readUInt32BE=function(t,e){return e||vv(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Gg.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||vv(t,e,this.length);for(var r=this[t],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*e)),r},Gg.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||vv(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},Gg.prototype.readInt8=function(t,e){return e||vv(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Gg.prototype.readInt16LE=function(t,e){e||vv(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},Gg.prototype.readInt16BE=function(t,e){e||vv(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},Gg.prototype.readInt32LE=function(t,e){return e||vv(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Gg.prototype.readInt32BE=function(t,e){return e||vv(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Gg.prototype.readFloatLE=function(t,e){return e||vv(t,4,this.length),Qg(this,t,!0,23,4)},Gg.prototype.readFloatBE=function(t,e){return e||vv(t,4,this.length),Qg(this,t,!1,23,4)},Gg.prototype.readDoubleLE=function(t,e){return e||vv(t,8,this.length),Qg(this,t,!0,52,8)},Gg.prototype.readDoubleBE=function(t,e){return e||vv(t,8,this.length),Qg(this,t,!1,52,8)},Gg.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||wv(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+n},Gg.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,1,255,0),Gg.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Gg.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,2,65535,0),Gg.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):bv(this,t,e,!0),e+2},Gg.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,2,65535,0),Gg.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):bv(this,t,e,!1),e+2},Gg.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,4,4294967295,0),Gg.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):Mv(this,t,e,!0),e+4},Gg.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,4,4294967295,0),Gg.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Mv(this,t,e,!1),e+4},Gg.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);wv(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+n},Gg.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);wv(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},Gg.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,1,127,-128),Gg.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Gg.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,2,32767,-32768),Gg.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):bv(this,t,e,!0),e+2},Gg.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,2,32767,-32768),Gg.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):bv(this,t,e,!1),e+2},Gg.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,4,2147483647,-2147483648),Gg.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Mv(this,t,e,!0),e+4},Gg.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Gg.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Mv(this,t,e,!1),e+4},Gg.prototype.writeFloatLE=function(t,e,n){return Nv(this,t,e,!0,n)},Gg.prototype.writeFloatBE=function(t,e,n){return Nv(this,t,e,!1,n)},Gg.prototype.writeDoubleLE=function(t,e,n){return Iv(this,t,e,!0,n)},Gg.prototype.writeDoubleBE=function(t,e,n){return Iv(this,t,e,!1,n)},Gg.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=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=0;--i)t[i+e]=this[i+n];else if(o<1e3||!Gg.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.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;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Tv(t){return function(t){var e,n,r,i,o,a;_g||Bg();var s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new Pg(3*s/4-o),r=o>0?s-4:s;var u=0;for(e=0,n=0;e>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=zg[t.charCodeAt(e)]<<2|zg[t.charCodeAt(e+1)]>>4,a[u++]=255&i):1===o&&(i=zg[t.charCodeAt(e)]<<10|zg[t.charCodeAt(e+1)]<<4|zg[t.charCodeAt(e+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Ev,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Lv(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Sv(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var jv=function(t){return t instanceof Gg},Cv=_f((function(t,e){var n=/%[sdj%]/g;e.format=function(t){if(!y(t)){for(var e=[],r=0;r=a)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(n)?r.showHidden=n:n&&e._extend(r,n),m(r.showHidden)&&(r.showHidden=!1),m(r.depth)&&(r.depth=2),m(r.colors)&&(r.colors=!1),m(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),u(r,t,r.depth)}function a(t,e){var n=o.styles[e];return n?"["+o.colors[n][0]+"m"+t+"["+o.colors[n][1]+"m":t}function s(t,e){return t}function u(t,n,r){if(t.customInspect&&n&&M(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,t);return y(i)||(i=u(t,i,r)),i}var o=function(t,e){if(m(e))return t.stylize("undefined","undefined");if(y(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return p(e)?t.stylize(""+e,"number"):d(e)?t.stylize(""+e,"boolean"):f(e)?t.stylize("null","null"):void 0}(t,n);if(o)return o;var a=Object.keys(n),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(n)),0===a.length){if(M(n)){var v=n.name?": "+n.name:"";return t.stylize("[Function"+v+"]","special")}if(g(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(w(n))return t.stylize(Date.prototype.toString.call(n),"date");if(b(n))return c(n)}var A,N="",I=!1,E=["{","}"];return h(n)&&(I=!0,E=["[","]"]),M(n)&&(N=" [Function"+(n.name?": "+n.name:"")+"]"),g(n)&&(N=" "+RegExp.prototype.toString.call(n)),w(n)&&(N=" "+Date.prototype.toUTCString.call(n)),b(n)&&(N=" "+c(n)),0!==a.length||I&&0!=n.length?r<0?g(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special"):(t.seen.push(n),A=I?function(t,e,n,r,i){for(var o=[],a=0,s=e.length;a60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}(A,N,E)):E[0]+N+E[1]}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function l(t,e,n,r,i,o){var a,s,c;if((c=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(s=t.stylize("[Setter]","special")),x(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(c.value)<0?(s=f(n)?u(t,c.value,null):u(t,c.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),m(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function h(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function f(t){return null===t}function p(t){return"number"==typeof t}function y(t){return"string"==typeof t}function m(t){return void 0===t}function g(t){return v(t)&&"[object RegExp]"===A(t)}function v(t){return"object"==typeof t&&null!==t}function w(t){return v(t)&&"[object Date]"===A(t)}function b(t){return v(t)&&("[object Error]"===A(t)||t instanceof Error)}function M(t){return"function"==typeof t}function A(t){return Object.prototype.toString.call(t)}function N(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(m(r)&&(r=k.env.NODE_DEBUG||""),t=t.toUpperCase(),!i[t])if(new RegExp("\\b"+t+"\\b","i").test(r)){var n=k.pid;i[t]=function(){var r=e.format.apply(e,arguments);console.error("%s %d: %s",t,n,r)}}else i[t]=function(){};return i[t]},e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=h,e.isBoolean=d,e.isNull=f,e.isNullOrUndefined=function(t){return null==t},e.isNumber=p,e.isString=y,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=m,e.isRegExp=g,e.isObject=v,e.isDate=w,e.isError=b,e.isFunction=M,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=jv;var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function E(){var t=new Date,e=[N(t.getHours()),N(t.getMinutes()),N(t.getSeconds())].join(":");return[t.getDate(),I[t.getMonth()],e].join(" ")}function x(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",E(),e.format.apply(e,arguments))},e.inherits=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})},e._extend=function(t,e){if(!e||!v(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}})),Dv=_f((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}}));function Ov(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function zv(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function Pv(t){return 1===t.length?"0"+t:t}function _v(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}var Bv={inherits:_f((function(t){try{var e=Cv;if("function"!=typeof e.inherits)throw"";t.exports=e.inherits}catch(e){t.exports=Dv}})),toArray:function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,n[r++]=63&o|128):Ov(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i>>0}return o},split32:function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},rotr32:function(t,e){return t>>>e|t<<32-e},rotl32:function(t,e){return t<>>32-e},sum32:function(t,e){return t+e>>>0},sum32_3:function(t,e,n){return t+e+n>>>0},sum32_4:function(t,e,n,r){return t+e+n+r>>>0},sum32_5:function(t,e,n,r,i){return t+e+n+r+i>>>0},sum64:function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o>>0,t[e+1]=o},sum64_hi:function(t,e,n,r){return(e+r>>>0>>0},sum64_lo:function(t,e,n,r){return e+r>>>0},sum64_4_hi:function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)>>0)>>0)>>0},sum64_4_lo:function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},sum64_5_hi:function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)>>0)>>0)>>0)>>0},sum64_5_lo:function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},rotr64_hi:function(t,e,n){return(e<<32-n|t>>>n)>>>0},rotr64_lo:function(t,e,n){return(t<<32-n|e>>>n)>>>0},shr64_hi:function(t,e,n){return t>>>n},shr64_lo:function(t,e,n){return(t<<32-n|e>>>n)>>>0}};function Rv(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var Uv=Rv;Rv.prototype.update=function(t,e){if(t=Bv.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=Bv.join32(t,0,t.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},Kv=function(t){return Yv(t,17)^Yv(t,19)^t>>>10},$v=Bv.rotl32,tw=Bv.sum32,ew=Bv.sum32_5,nw=Hv,rw=Qv.BlockHash,iw=[1518500249,1859775393,2400959708,3395469782];function ow(){if(!(this instanceof ow))return new ow;rw.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Bv.inherits(ow,rw);var aw=ow;ow.blockSize=512,ow.outSize=160,ow.hmacStrength=80,ow.padLength=64,ow.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;rthis.blockSize&&(t=(new this.Hash).update(t).digest()),Cg(t.length<=this.blockSize);for(var e=t.length;e>8,a=255&i;o?n.push(o,a):n.push(a)}return n},n.zero2=r,n.toHex=i,n.encode=function(t,e){return"hex"===e?i(t):t}})),bb=mb((function(t,e){var n=e;n.assert=gb,n.toArray=wb.toArray,n.zero2=wb.zero2,n.toHex=wb.toHex,n.encode=wb.encode,n.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},n.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!=(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0==(1&c)?0:3!=(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},n.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new jg(t,"hex","le")}})),Mb=bb.getNAF,Ab=bb.getJSF,Nb=bb.assert;function Ib(t,e){this.type=t,this.p=new jg(e.p,16),this.red=e.prime?jg.red(e.prime):jg.mont(this.p),this.zero=new jg(0).toRed(this.red),this.one=new jg(1).toRed(this.red),this.two=new jg(2).toRed(this.red),this.n=e.n&&new jg(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Eb=Ib;function xb(t,e){this.curve=t,this.type=e,this.precomputed=null}Ib.prototype.point=function(){throw new Error("Not implemented")},Ib.prototype.validate=function(){throw new Error("Not implemented")},Ib.prototype._fixedNafMul=function(t,e){Nb(t.precomputed);var n=t._getDoubles(),r=Mb(e,1,this._bitLength),i=(1<=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];Nb(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},Ib.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var y=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(y[1]=e[f].add(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].add(e[p].neg())):(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=Ab(n[f],n[p]);for(h=Math.max(g[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a=0;o--){for(var A=0;o>=0;){var N=!0;for(a=0;a=0&&A++,b=b.dblp(A),o<0)break;for(a=0;a0?s=c[a][I-1>>1]:I<0&&(s=c[a][-I-1>>1].neg()),b="affine"===s.type?b.mixedAdd(s):b.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},xb.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},Lb.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},Lb.prototype.pointFromX=function(t,e){(t=new jg(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},Lb.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Lb.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},jb.prototype.isInfinity=function(){return this.inf},jb.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},jb.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},jb.prototype.getX=function(){return this.x.fromRed()},jb.prototype.getY=function(){return this.y.fromRed()},jb.prototype.mul=function(t){return t=new jg(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},jb.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},jb.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},jb.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},jb.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},jb.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},kb(Cb,Eb.BasePoint),Lb.prototype.jpoint=function(t,e,n){return new Cb(this,t,e,n)},Cb.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},Cb.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Cb.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},Cb.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},Cb.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},Cb.prototype.inspect=function(){return this.isInfinity()?"":""},Cb.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Db=mb((function(t,e){var n=e;n.base=Eb,n.short=Sb,n.mont=null,n.edwards=null})),Ob=mb((function(t,e){var n,r=e,i=bb.assert;function o(t){"short"===t.type?this.curve=new Db.short(t):"edwards"===t.type?this.curve=new Db.edwards(t):this.curve=new Db.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new o(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:yb.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:yb.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:yb.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:yb.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:yb.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:yb.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:yb.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(t){n=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:yb.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function zb(t){if(!(this instanceof zb))return new zb(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=wb.toArray(t.entropy,t.entropyEnc||"hex"),n=wb.toArray(t.nonce,t.nonceEnc||"hex"),r=wb.toArray(t.pers,t.persEnc||"hex");gb(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var Pb=zb;zb.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},zb.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=wb.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var Ub=bb.assert;function Qb(t,e){if(t instanceof Qb)return t;this._importDER(t,e)||(Ub(t.r&&t.s,"Signature without r or s"),this.r=new jg(t.r,16),this.s=new jg(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Yb=Qb;function Wb(){this.place=0}function Fb(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o>>=0;return!(i<=127)&&(e.place=a,i)}function Vb(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}Qb.prototype._importDER=function(t,e){t=bb.toArray(t,e);var n=new Wb;if(48!==t[n.place++])return!1;var r=Fb(t,n);if(!1===r)return!1;if(r+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var i=Fb(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=Fb(t,n);if(!1===a)return!1;if(t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new jg(o),this.s=new jg(s),this.recoveryParam=null,!0},Qb.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=Vb(e),n=Vb(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];Hb(r,e.length),(r=r.concat(e)).push(2),Hb(r,n.length);var i=r.concat(n),o=[48];return Hb(o,i.length),o=o.concat(i),bb.encode(o,t)};var Gb=function(){throw new Error("unsupported")},qb=bb.assert;function Zb(t){if(!(this instanceof Zb))return new Zb(t);"string"==typeof t&&(qb(Object.prototype.hasOwnProperty.call(Ob,t),"Unknown curve "+t),t=Ob[t]),t instanceof Ob.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Jb=Zb;Zb.prototype.keyPair=function(t){return new Rb(this,t)},Zb.prototype.keyFromPrivate=function(t,e){return Rb.fromPrivate(this,t,e)},Zb.prototype.keyFromPublic=function(t,e){return Rb.fromPublic(this,t,e)},Zb.prototype.genKeyPair=function(t){t||(t={});for(var e=new Pb({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||Gb(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new jg(2));;){var i=new jg(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Zb.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Zb.prototype.sign=function(t,e,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new jg(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new Pb({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new jg(1)),c=0;;c++){var l=r.k?r.k(c):new jg(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new Yb({r:f,s:p,recoveryParam:y})}}}}}},Zb.prototype.verify=function(t,e,n,r){t=this._truncateToN(new jg(t,16)),n=this.keyFromPublic(n,r);var i=(e=new Yb(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},Zb.prototype.recoverPubKey=function(t,e,n,r){qb((3&n)===n,"The recovery param is more than two bits"),e=new Yb(e,r);var i=this.n,o=new jg(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},Zb.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new Yb(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var Xb=mb((function(t,e){var n=e;n.version="6.5.4",n.utils=bb,n.rand=function(){throw new Error("unsupported")},n.curve=Db,n.curves=Ob,n.ec=Jb,n.eddsa=null})).ec;const Kb=new sp("signing-key/5.7.0");let $b=null;function tM(){return $b||($b=new Xb("secp256k1")),$b}class eM{constructor(t){Kp(this,"curve","secp256k1"),Kp(this,"privateKey",bp(t)),32!==Mp(this.privateKey)&&Kb.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=tM().keyFromPrivate(pp(this.privateKey));Kp(this,"publicKey","0x"+e.getPublic(!1,"hex")),Kp(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Kp(this,"_isSigningKey",!0)}_addPoint(t){const e=tM().keyFromPublic(pp(this.publicKey)),n=tM().keyFromPublic(pp(t));return"0x"+e.pub.add(n.pub).encodeCompressed("hex")}signDigest(t){const e=tM().keyFromPrivate(pp(this.privateKey)),n=pp(t);32!==n.length&&Kb.throwArgumentError("bad digest length","digest",t);const r=e.sign(n,{canonical:!0});return xp({recoveryParam:r.recoveryParam,r:Ep("0x"+r.r.toString(16),32),s:Ep("0x"+r.s.toString(16),32)})}computeSharedSecret(t){const e=tM().keyFromPrivate(pp(this.privateKey)),n=tM().keyFromPublic(pp(nM(t)));return Ep("0x"+e.derive(n.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function nM(t,e){const n=pp(t);if(32===n.length){const t=new eM(n);return e?"0x"+tM().keyFromPrivate(n).getPublic(!0,"hex"):t.publicKey}return 33===n.length?e?bp(n):"0x"+tM().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?e?"0x"+tM().keyFromPublic(n).getPublic(!0,"hex"):bp(n):Kb.throwArgumentError("invalid public or private key","key","[REDACTED]")}const rM=new sp("transactions/5.7.0");var iM;function oM(t){return"0x"===t?null:Zy(t)}function aM(t){return"0x"===t?cm:Dp.from(t)}function sM(t,e){return function(t){return Zy(Ap(Py(Ap(nM(t),1)),12))}(function(t,e){const n=xp(e),r={r:pp(n.r),s:pp(n.s)};return"0x"+tM().recoverPubKey(pp(t),r,n.recoveryParam).encode("hex",!1)}(pp(t),e))}function uM(t,e){const n=mp(Dp.from(t).toHexString());return n.length>32&&rM.throwArgumentError("invalid length for "+e,"transaction:"+e,t),n}function cM(t,e){return{address:Zy(t),storageKeys:(e||[]).map(((e,n)=>(32!==Mp(e)&&rM.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,e),e.toLowerCase())))}}function lM(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&rM.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),cM(t[0],t[1])):cM(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const n=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return cM(e,Object.keys(n).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function hM(t){return lM(t).map((t=>[t.address,t.storageKeys]))}function dM(t,e){if(null!=t.gasPrice){const e=Dp.from(t.gasPrice),n=Dp.from(t.maxFeePerGas||0);e.eq(n)||rM.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:n})}const n=[uM(t.chainId||0,"chainId"),uM(t.nonce||0,"nonce"),uM(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),uM(t.maxFeePerGas||0,"maxFeePerGas"),uM(t.gasLimit||0,"gasLimit"),null!=t.to?Zy(t.to):"0x",uM(t.value||0,"value"),t.data||"0x",hM(t.accessList||[])];if(e){const t=xp(e);n.push(uM(t.recoveryParam,"recoveryParam")),n.push(mp(t.r)),n.push(mp(t.s))}return Np(["0x02",Qy(n)])}function fM(t,e){const n=[uM(t.chainId||0,"chainId"),uM(t.nonce||0,"nonce"),uM(t.gasPrice||0,"gasPrice"),uM(t.gasLimit||0,"gasLimit"),null!=t.to?Zy(t.to):"0x",uM(t.value||0,"value"),t.data||"0x",hM(t.accessList||[])];if(e){const t=xp(e);n.push(uM(t.recoveryParam,"recoveryParam")),n.push(mp(t.r)),n.push(mp(t.s))}return Np(["0x01",Qy(n)])}function pM(t,e,n){try{const n=aM(e[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");t.v=n}catch(t){rM.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=Ep(e[1],32),t.s=Ep(e[2],32);try{const e=Py(n(t));t.from=sM(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){}}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(iM||(iM={}));var yM=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const mM=new sp("contracts/5.7.0");function gM(t,e){return yM(this,void 0,void 0,(function*(){const n=yield e;"string"!=typeof n&&mM.throwArgumentError("invalid address or ENS name","name",n);try{return Zy(n)}catch(t){}t||mM.throwError("a provider or signer is needed to resolve ENS names",sp.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield t.resolveName(n);return null==r&&mM.throwArgumentError("resolver or addr is not configured for ENS name","name",n),r}))}function vM(t,e,n){return yM(this,void 0,void 0,(function*(){return Array.isArray(n)?yield Promise.all(n.map(((n,r)=>vM(t,Array.isArray(e)?e[r]:e[n.name],n)))):"address"===n.type?yield gM(t,e):"tuple"===n.type?yield vM(t,e,n.components):"array"===n.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>vM(t,e,n.arrayChildren)))):Promise.reject(mM.makeError("invalid value for array",sp.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function wM(t,e,n){return yM(this,void 0,void 0,(function*(){let r={};n.length===e.inputs.length+1&&"object"==typeof n[n.length-1]&&(r=ey(n.pop())),mM.checkArgumentCount(n.length,e.inputs.length,"passed to contract"),t.signer?r.from?r.from=ty({override:gM(t.signer,r.from),signer:t.signer.getAddress()}).then((t=>yM(this,void 0,void 0,(function*(){return Zy(t.signer)!==t.override&&mM.throwError("Contract with a Signer cannot override from",sp.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):r.from=t.signer.getAddress():r.from&&(r.from=gM(t.provider,r.from));const i=yield ty({args:vM(t.signer||t.provider,n,e.inputs),address:t.resolvedAddress,overrides:ty(r)||{}}),o=t.interface.encodeFunctionData(e,i.args),a={data:o,to:i.address},s=i.overrides;if(null!=s.nonce&&(a.nonce=Dp.from(s.nonce).toNumber()),null!=s.gasLimit&&(a.gasLimit=Dp.from(s.gasLimit)),null!=s.gasPrice&&(a.gasPrice=Dp.from(s.gasPrice)),null!=s.maxFeePerGas&&(a.maxFeePerGas=Dp.from(s.maxFeePerGas)),null!=s.maxPriorityFeePerGas&&(a.maxPriorityFeePerGas=Dp.from(s.maxPriorityFeePerGas)),null!=s.from&&(a.from=s.from),null!=s.type&&(a.type=s.type),null!=s.accessList&&(a.accessList=lM(s.accessList)),null==a.gasLimit&&null!=e.gas){let t=21e3;const n=pp(o);for(let e=0;enull!=r[t]));return u.length&&mM.throwError(`cannot override ${u.map((t=>JSON.stringify(t))).join(",")}`,sp.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),a}))}function bM(t,e,n){const r=t.signer||t.provider;return function(...i){return yM(this,void 0,void 0,(function*(){let o;if(i.length===e.inputs.length+1&&"object"==typeof i[i.length-1]){const t=ey(i.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,i.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const a=yield wM(t,e,i),s=yield r.call(a,o);try{let r=t.interface.decodeFunctionResult(e,s);return n&&1===e.outputs.length&&(r=r[0]),r}catch(e){throw e.code===sp.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=i,e.transaction=a),e}}))}}function MM(t,e,n){return e.constant?bM(t,e,n):function(t,e){return function(...n){return yM(this,void 0,void 0,(function*(){t.signer||mM.throwError("sending a transaction requires a signer",sp.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const r=yield wM(t,e,n),i=yield t.signer.sendTransaction(r);return function(t,e){const n=e.wait.bind(e);e.wait=e=>n(e).then((e=>(e.events=e.logs.map((n=>{let r=oy(n),i=null;try{i=t.interface.parseLog(n)}catch(t){}return i&&(r.args=i.args,r.decode=(e,n)=>t.interface.decodeEventLog(i.eventFragment,e,n),r.event=i.name,r.eventSignature=i.signature),r.removeListener=()=>t.provider,r.getBlock=()=>t.provider.getBlock(e.blockHash),r.getTransaction=()=>t.provider.getTransaction(e.transactionHash),r.getTransactionReceipt=()=>Promise.resolve(e),r})),e)))}(t,i),i}))}}(t,e)}function AM(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class NM{constructor(t,e){Kp(this,"tag",t),Kp(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((n=>!(!e&&n.listener===t&&(e=!0,1))))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const n=t.slice();return setTimeout((()=>{e.listener.apply(this,n)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class IM extends NM{constructor(){super("error",null)}}class EM extends NM{constructor(t,e,n,r){const i={address:t};let o=e.getEventTopic(n);r?(o!==r[0]&&mM.throwArgumentError("topic mismatch","topics",r),i.topics=r.slice()):i.topics=[o],super(AM(i),i),Kp(this,"address",t),Kp(this,"interface",e),Kp(this,"fragment",n)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=function(t){const e=[],n=function(t,r){if(Array.isArray(r))for(let i in r){const o=t.slice();o.push(i);try{n(o,r[i])}catch(t){e.push({path:o,error:t})}}};return n([],t),e}(t.args);if(e.length)throw e[0].error;const n=(t.args||[]).slice();return n.push(t),n}}class xM extends NM{constructor(t,e){super("*",{address:t}),Kp(this,"address",t),Kp(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,n)=>this.interface.decodeEventLog(e.eventFragment,t,n),t.args=e.args}catch(t){}}}class kM extends class{constructor(t,e,n){Kp(this,"interface",$p(new.target,"getInterface")(e)),null==n?(Kp(this,"provider",null),Kp(this,"signer",null)):Lg.isSigner(n)?(Kp(this,"provider",n.provider||null),Kp(this,"signer",n)):Ig.isProvider(n)?(Kp(this,"provider",n),Kp(this,"signer",null)):mM.throwArgumentError("invalid signer or provider","signerOrProvider",n),Kp(this,"callStatic",{}),Kp(this,"estimateGas",{}),Kp(this,"functions",{}),Kp(this,"populateTransaction",{}),Kp(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const n=this.interface.events[e];Kp(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(n,t)}))),t[n.name]||(t[n.name]=[]),t[n.name].push(e)})),Object.keys(t).forEach((e=>{const n=t[e];1===n.length?Kp(this.filters,e,this.filters[n[0]]):mM.warn(`Duplicate definition of ${e} (${n.join(", ")})`)}))}if(Kp(this,"_runningEvents",{}),Kp(this,"_wrappedEmits",{}),null==t&&mM.throwArgumentError("invalid contract address or ENS name","addressOrName",t),Kp(this,"address",t),this.provider)Kp(this,"resolvedAddress",gM(this.provider,t));else try{Kp(this,"resolvedAddress",Promise.resolve(Zy(t)))}catch(t){mM.throwError("provider is required to use ENS name as contract address",sp.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((t=>{}));const r={},i={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(i[t])mM.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{i[t]=!0;{const n=e.name;r[`%${n}`]||(r[`%${n}`]=[]),r[`%${n}`].push(t)}null==this[t]&&Kp(this,t,MM(this,e,!0)),null==this.functions[t]&&Kp(this.functions,t,MM(this,e,!1)),null==this.callStatic[t]&&Kp(this.callStatic,t,bM(this,e,!0)),null==this.populateTransaction[t]&&Kp(this.populateTransaction,t,function(t,e){return function(...n){return wM(t,e,n)}}(this,e)),null==this.estimateGas[t]&&Kp(this.estimateGas,t,function(t,e){const n=t.signer||t.provider;return function(...r){return yM(this,void 0,void 0,(function*(){n||mM.throwError("estimate require a provider or signer",sp.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield wM(t,e,r);return yield n.estimateGas(i)}))}}(this,e))}})),Object.keys(r).forEach((t=>{const e=r[t];if(e.length>1)return;t=t.substring(1);const n=e[0];try{null==this[t]&&Kp(this,t,this[n])}catch(t){}null==this.functions[t]&&Kp(this.functions,t,this.functions[n]),null==this.callStatic[t]&&Kp(this.callStatic,t,this.callStatic[n]),null==this.populateTransaction[t]&&Kp(this.populateTransaction,t,this.populateTransaction[n]),null==this.estimateGas[t]&&Kp(this.estimateGas,t,this.estimateGas[n])}))}static getContractAddress(t){return Jy(t)}static getInterface(t){return Mg.isInterface(t)?t:new Mg(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,t).then((t=>("0x"===t&&mM.throwError("contract not deployed",sp.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||mM.throwError("sending a transactions require a signer",sp.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=ey(t||{});return["from","to"].forEach((function(t){null!=e[t]&&mM.throwError("cannot override "+t,sp.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new Sg(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&Kp(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return vg.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new IM);if("event"===t)return this._normalizeRunningEvent(new NM("event",null));if("*"===t)return this._normalizeRunningEvent(new xM(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new EM(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const n=this.interface.getEvent(e);return this._normalizeRunningEvent(new EM(this.address,this.interface,n,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new NM(AM(e),e))}return this._normalizeRunningEvent(new xM(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,n){const r=oy(e);return r.removeListener=()=>{n&&(t.removeListener(n),this._checkRunningEvents(t))},r.getBlock=()=>this.provider.getBlock(e.blockHash),r.getTransaction=()=>this.provider.getTransaction(e.transactionHash),r.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(r),r}_addEventListener(t,e,n){if(this.provider||mM.throwError("events require a provider or a signer with a provider",sp.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,n),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const n=n=>{let r=this._wrapEvent(t,n,e);if(null==r.decodeError)try{const e=t.getEmit(r);this.emit(t.filter,...e)}catch(t){r.decodeError=t.error}null!=t.filter&&this.emit("event",r),null!=r.decodeError&&this.emit("error",r.decodeError,r)};this._wrappedEmits[t.tag]=n,null!=t.filter&&this.provider.on(t.filter,n)}}queryFilter(t,e,n){const r=this._getRunningEvent(t),i=ey(r.filter);return"string"==typeof e&&vp(e,32)?(null!=n&&mM.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),i.blockHash=e):(i.fromBlock=null!=e?e:0,i.toBlock=null!=n?n:"latest"),this.provider.getLogs(i).then((t=>t.map((t=>this._wrapEvent(r,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const n=this._getRunningEvent(t),r=n.run(e)>0;return this._checkRunningEvents(n),r}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const n=this._getRunningEvent(t);return n.removeListener(e),this._checkRunningEvents(n),this}removeListener(t,e){return this.off(t,e)}}{}class TM{constructor(t){Kp(this,"alphabet",t),Kp(this,"base",t.length),Kp(this,"_alphabetMap",{}),Kp(this,"_leader",t.charAt(0));for(let e=0;e0;)n.push(r%this.base),r=r/this.base|0}let r="";for(let t=0;0===e[t]&&t=0;--t)r+=this.alphabet[n[t]];return r}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let n=0;n>=8;for(;i>0;)e.push(255&i),i>>=8}for(let n=0;t[n]===this._leader&&n{o[e.toLowerCase()]=t})):r.headers.keys().forEach((t=>{o[t.toLowerCase()]=r.headers.get(t)})),{headers:o,statusCode:r.status,statusMessage:r.statusText,body:pp(new Uint8Array(i))}}))}const RM=new sp("web/5.7.1");function UM(t){return new Promise((e=>{setTimeout(e,t)}))}function QM(t,e){if(null==t)return null;if("string"==typeof t)return t;if(hp(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return bm(t)}catch(t){}return bp(t)}return t}function YM(t,e,n){let r=null;if(null!=e){r=wm(e);const n="string"==typeof t?{url:t}:ey(t);n.headers?0!==Object.keys(n.headers).filter((t=>"content-type"===t.toLowerCase())).length||(n.headers=ey(n.headers),n.headers["content-type"]="application/json"):n.headers={"content-type":"application/json"},t=n}return function(t,e,n){const r="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;RM.assertArgument(r>0&&r%1==0,"invalid connection throttle limit","connection.throttleLimit",r);const i="object"==typeof t?t.throttleCallback:null,o="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;RM.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const a="object"==typeof t&&!!t.errorPassThrough,s={};let u=null;const c={method:"GET"};let l=!1,h=12e4;if("string"==typeof t)u=t;else if("object"==typeof t){if(null!=t&&null!=t.url||RM.throwArgumentError("missing URL","connection.url",t),u=t.url,"number"==typeof t.timeout&&t.timeout>0&&(h=t.timeout),t.headers)for(const e in t.headers)s[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(l=!0);if(c.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==u.substring(0,6)&&!0!==t.allowInsecureAuthentication&&RM.throwError("basic authentication requires a secure https url",sp.errors.INVALID_ARGUMENT,{argument:"url",url:u,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;s.authorization={key:"Authorization",value:"Basic "+Sm(wm(e))}}null!=t.skipFetchSetup&&(c.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(c.fetchOptions=ey(t.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),f=u?u.match(d):null;if(f)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]||"text/plain"},body:f[2]?Lm(f[3]):(p=f[3],wm(p.replace(/%([0-9a-f][0-9a-f])/gi,((t,e)=>String.fromCharCode(parseInt(e,16))))))};let e=t.body;return n&&(e=n(t.body,t)),Promise.resolve(e)}catch(t){RM.throwError("processing response error",sp.errors.SERVER_ERROR,{body:QM(f[1],f[2]),error:t,requestBody:null,requestMethod:"GET",url:u})}var p;e&&(c.method="POST",c.body=e,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(e.length)}));const y={};Object.keys(s).forEach((t=>{const e=s[t];y[e.key]=e.value})),c.headers=y;const m=function(){let t=null;return{promise:new Promise((function(e,n){h&&(t=setTimeout((()=>{null!=t&&(t=null,n(RM.makeError("timeout",sp.errors.TIMEOUT,{requestBody:QM(c.body,y["content-type"]),requestMethod:c.method,timeout:h,url:u})))}),h))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),g=function(){return function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}(this,void 0,void 0,(function*(){for(let t=0;t=300)&&(m.cancel(),RM.throwError("bad response",sp.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:QM(s,e.headers?e.headers["content-type"]:null),requestBody:QM(c.body,y["content-type"]),requestMethod:c.method,url:u})),n)try{const t=yield n(s,e);return m.cancel(),t}catch(n){if(n.throttleRetry&&t{let r=null;if(null!=t)try{r=JSON.parse(bm(t))}catch(e){RM.throwError("invalid JSON",sp.errors.SERVER_ERROR,{body:t,error:e})}return n&&(r=n(r,e)),r}))}function WM(t,e){return e||(e={}),null==(e=ey(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(n,r){let i=null,o=!1;const a=()=>!o&&(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout((()=>{a()&&r(new Error("timeout"))}),e.timeout));const s=e.retryLimit;let u=0;!function i(){return t().then((function(t){if(void 0!==t)a()&&n(t);else if(e.oncePoll)e.oncePoll.once("poll",i);else if(e.onceBlock)e.onceBlock.once("block",i);else if(!o){if(u++,u>s)return void(a()&&r(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,u)));te.ceiling&&(t=e.ceiling),setTimeout(i,t)}return null}),(function(t){a()&&r(t)}))}()}))}for(var FM="qpzry9x8gf2tvdw0s3jn54khce6mua7l",VM={},HM=0;HM>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function ZM(t){for(var e=1,n=0;n126)return"Invalid prefix ("+t+")";e=qM(e)^r>>5}for(e=qM(e),n=0;n=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<=e)return"Excess padding";if(i<n)throw new TypeError("Exceeds length limit");var r=ZM(t=t.toLowerCase());if("string"==typeof r)throw new Error(r);for(var i=t+"1",o=0;o>5!=0)throw new Error("Non 5-bit word");r=qM(r)^a,i+=FM.charAt(a)}for(o=0;o<6;++o)r=qM(r);for(r^=1,o=0;o<6;++o)i+=FM.charAt(r>>5*(5-o)&31);return i},KM=function(t){var e=JM(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)};const $M="providers/5.7.2",tA=new sp($M);class eA{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),n=this.bigNumber.bind(this),r=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),s=this.number.bind(this),u=this.type.bind(this);return t.transaction={hash:o,type:u,accessList:eA.allowNull(this.accessList.bind(this),null),blockHash:eA.allowNull(o,null),blockNumber:eA.allowNull(s,null),transactionIndex:eA.allowNull(s,null),confirmations:eA.allowNull(s,null),from:e,gasPrice:eA.allowNull(n),maxPriorityFeePerGas:eA.allowNull(n),maxFeePerGas:eA.allowNull(n),gasLimit:n,to:eA.allowNull(e,null),value:n,nonce:s,data:i,r:eA.allowNull(this.uint256),s:eA.allowNull(this.uint256),v:eA.allowNull(s),creates:eA.allowNull(e,null),raw:eA.allowNull(i)},t.transactionRequest={from:eA.allowNull(e),nonce:eA.allowNull(s),gasLimit:eA.allowNull(n),gasPrice:eA.allowNull(n),maxPriorityFeePerGas:eA.allowNull(n),maxFeePerGas:eA.allowNull(n),to:eA.allowNull(e),value:eA.allowNull(n),data:eA.allowNull((t=>this.data(t,!0))),type:eA.allowNull(s),accessList:eA.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:s,blockNumber:s,transactionHash:o,address:e,topics:eA.arrayOf(o),data:i,logIndex:s,blockHash:o},t.receipt={to:eA.allowNull(this.address,null),from:eA.allowNull(this.address,null),contractAddress:eA.allowNull(e,null),transactionIndex:s,root:eA.allowNull(a),gasUsed:n,logsBloom:eA.allowNull(i),blockHash:o,transactionHash:o,logs:eA.arrayOf(this.receiptLog.bind(this)),blockNumber:s,confirmations:eA.allowNull(s,null),cumulativeGasUsed:n,effectiveGasPrice:eA.allowNull(n),status:eA.allowNull(s),type:u},t.block={hash:eA.allowNull(o),parentHash:o,number:s,timestamp:s,nonce:eA.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:eA.allowNull(e),extraData:i,transactions:eA.allowNull(eA.arrayOf(o)),baseFeePerGas:eA.allowNull(n)},t.blockWithTransactions=ey(t.block),t.blockWithTransactions.transactions=eA.allowNull(eA.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:eA.allowNull(r,void 0),toBlock:eA.allowNull(r,void 0),blockHash:eA.allowNull(o,void 0),address:eA.allowNull(e,void 0),topics:eA.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:eA.allowNull(s),blockHash:eA.allowNull(o),transactionIndex:s,removed:eA.allowNull(this.boolean.bind(this)),address:e,data:eA.allowFalsish(i,"0x"),topics:eA.arrayOf(o),transactionHash:o,logIndex:s},t}accessList(t){return lM(t||[])}number(t){return"0x"===t?0:Dp.from(t).toNumber()}type(t){return"0x"===t||null==t?0:Dp.from(t).toNumber()}bigNumber(t){return Dp.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),vp(t))?t.toLowerCase():tA.throwArgumentError("invalid hash","value",t)}data(t,e){const n=this.hex(t,e);if(n.length%2!=0)throw new Error("invalid data; odd-length - "+t);return n}address(t){return Zy(t)}callAddress(t){if(!vp(t,32))return null;const e=Zy(Ap(t,12));return"0x0000000000000000000000000000000000000000"===e?null:e}contractAddress(t){return Jy(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";switch(t){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return t}if("number"==typeof t||vp(t))return Ip(t);throw new Error("invalid blockTag")}hash(t,e){const n=this.hex(t,e);return 32!==Mp(n)?tA.throwArgumentError("invalid hash","value",t):n}difficulty(t){if(null==t)return null;const e=Dp.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!vp(t))throw new Error("invalid uint256");return Ep(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);const n=null!=t._difficulty?t._difficulty:t.difficulty,r=eA.check(e,t);return r._difficulty=null==n?null:Dp.from(n),r}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return eA.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&Dp.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const e=eA.check(this.formats.transaction,t);if(null!=t.chainId){let n=t.chainId;vp(n)&&(n=Dp.from(n).toNumber()),e.chainId=n}else{let n=t.networkId;null==n&&null==e.v&&(n=t.chainId),vp(n)&&(n=Dp.from(n).toNumber()),"number"!=typeof n&&null!=e.v&&(n=(e.v-35)/2,n<0&&(n=0),n=parseInt(n)),"number"!=typeof n&&(n=0),e.chainId=n}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return function(t){const e=pp(t);if(e[0]>127)return function(t){const e=Fy(t);9!==e.length&&6!==e.length&&rM.throwArgumentError("invalid raw transaction","rawTransaction",t);const n={nonce:aM(e[0]).toNumber(),gasPrice:aM(e[1]),gasLimit:aM(e[2]),to:oM(e[3]),value:aM(e[4]),data:e[5],chainId:0};if(6===e.length)return n;try{n.v=Dp.from(e[6]).toNumber()}catch(t){return n}if(n.r=Ep(e[7],32),n.s=Ep(e[8],32),Dp.from(n.r).isZero()&&Dp.from(n.s).isZero())n.chainId=n.v,n.v=0;else{n.chainId=Math.floor((n.v-35)/2),n.chainId<0&&(n.chainId=0);let r=n.v-27;const i=e.slice(0,6);0!==n.chainId&&(i.push(bp(n.chainId)),i.push("0x"),i.push("0x"),r-=2*n.chainId+8);const o=Py(Qy(i));try{n.from=sM(o,{r:bp(n.r),s:bp(n.s),recoveryParam:r})}catch(t){}n.hash=Py(t)}return n.type=null,n}(e);switch(e[0]){case 1:return function(t){const e=Fy(t.slice(1));8!==e.length&&11!==e.length&&rM.throwArgumentError("invalid component count for transaction type: 1","payload",bp(t));const n={type:1,chainId:aM(e[0]).toNumber(),nonce:aM(e[1]).toNumber(),gasPrice:aM(e[2]),gasLimit:aM(e[3]),to:oM(e[4]),value:aM(e[5]),data:e[6],accessList:lM(e[7])};return 8===e.length||(n.hash=Py(t),pM(n,e.slice(8),fM)),n}(e);case 2:return function(t){const e=Fy(t.slice(1));9!==e.length&&12!==e.length&&rM.throwArgumentError("invalid component count for transaction type: 2","payload",bp(t));const n=aM(e[2]),r=aM(e[3]),i={type:2,chainId:aM(e[0]).toNumber(),nonce:aM(e[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:aM(e[4]),to:oM(e[5]),value:aM(e[6]),data:e[7],accessList:lM(e[8])};return 9===e.length||(i.hash=Py(t),pM(i,e.slice(9),dM)),i}(e)}return rM.throwError(`unsupported transaction type: ${e[0]}`,sp.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}(t)}receiptLog(t){return eA.check(this.formats.receiptLog,t)}receipt(t){const e=eA.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=Dp.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&tA.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):tA.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&tA.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map((t=>this.topics(t))):null!=t?this.hash(t,!0):null}filter(t){return eA.check(this.formats.filter,t)}filterLog(t){return eA.check(this.formats.filterLog,t)}static check(t,e){const n={};for(const r in t)try{const i=t[r](e[r]);void 0!==i&&(n[r]=i)}catch(t){throw t.checkKey=r,t.checkValue=e[r],t}return n}static allowNull(t,e){return function(n){return null==n?e:t(n)}}static allowFalsish(t,e){return function(n){return n?t(n):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const n=[];return e.forEach((function(e){n.push(t(e))})),n}}}var nA=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const rA=new sp($M);function iA(t){return null==t?"null":(32!==Mp(t)&&rA.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function oA(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map((t=>{if(Array.isArray(t)){const e={};t.forEach((t=>{e[iA(t)]=!0}));const n=Object.keys(e);return n.sort(),n.join("|")}return iA(t)})).join("&")}function aA(t){if("string"==typeof t){if(32===Mp(t=t.toLowerCase()))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+oA(t);if(Ng.isForkEvent(t))throw rA.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+oA(t.topics||[])}throw new Error("invalid event - "+t)}function sA(){return(new Date).getTime()}function uA(t){return new Promise((e=>{setTimeout(e,t)}))}const cA=["block","network","pending","poll"];class lA{constructor(t,e,n){Kp(this,"tag",t),Kp(this,"listener",e),Kp(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],n=""===(r=t[2])?[]:r.split(/&/g).map((t=>{if(""===t)return[];const e=t.split("|").map((t=>"null"===t?null:t));return 1===e.length?e[0]:e}));var r;const i={};return n.length>0&&(i.topics=n),e&&"*"!==e&&(i.address=e),i}pollable(){return this.tag.indexOf(":")>=0||cA.indexOf(this.tag)>=0}}const hA={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function dA(t){return Ep(Dp.from(t).toHexString(),32)}function fA(t){return LM.encode(yp([t,Ap(SM(SM(t)),0,4)]))}const pA=new RegExp("^(ipfs)://(.*)$","i"),yA=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),pA,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function mA(t,e){try{return bm(gA(t,e))}catch(t){}return null}function gA(t,e){if("0x"===t)return null;const n=Dp.from(Ap(t,e,e+32)).toNumber(),r=Dp.from(Ap(t,n,n+32)).toNumber();return Ap(t,n+32,n+32+r)}function vA(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):rA.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function wA(t){const e=pp(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function bA(t){if(t.length%32==0)return t;const e=new Uint8Array(32*Math.ceil(t.length/32));return e.set(t),e}function MA(t){const e=[];let n=0;for(let r=0;rDp.from(t).eq(1))).catch((t=>{if(t.code===sp.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t}))),this._supportsEip2544}_fetch(t,e){return nA(this,void 0,void 0,(function*(){const n={to:this.address,ccipReadEnabled:!0,data:Np([t,Km(this.name),e||"0x"])};let r=!1;var i;(yield this.supportsWildcard())&&(r=!0,n.data=Np(["0x9061b923",MA([(i=this.name,bp(yp(Xm(i).map((t=>{if(t.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const e=new Uint8Array(t.length+1);return e.set(t,1),e[0]=e.length-1,e}))))+"00"),n.data])]));try{let t=yield this.provider.call(n);return pp(t).length%32==4&&rA.throwError("resolver threw error",sp.errors.CALL_EXCEPTION,{transaction:n,data:t}),r&&(t=gA(t,0)),t}catch(t){if(t.code===sp.errors.CALL_EXCEPTION)return null;throw t}}))}_fetchBytes(t,e){return nA(this,void 0,void 0,(function*(){const n=yield this._fetch(t,e);return null!=n?gA(n,0):null}))}_getAddress(t,e){const n=hA[String(t)];if(null==n&&rA.throwError(`unsupported coin type: ${t}`,sp.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===n.ilk)return this.provider.formatter.address(e);const r=pp(e);if(null!=n.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return fA(yp([[n.p2pkh],"0x"+t[2]]))}}if(null!=n.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return fA(yp([[n.p2sh],"0x"+t[2]]))}}if(null!=n.prefix){const t=r[1];let e=r[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&r.length===2+t&&t>=1&&t<=75){const t=KM(r.slice(2));return t.unshift(e),XM(n.prefix,t)}}return null}getAddress(t){return nA(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t)try{const t=yield this._fetch("0x3b3b57de");return"0x"===t||"0x0000000000000000000000000000000000000000000000000000000000000000"===t?null:this.provider.formatter.callAddress(t)}catch(t){if(t.code===sp.errors.CALL_EXCEPTION)return null;throw t}const e=yield this._fetchBytes("0xf1cb7e06",dA(t));if(null==e||"0x"===e)return null;const n=this._getAddress(t,e);return null==n&&rA.throwError("invalid or unsupported coin data",sp.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),n}))}getAvatar(){return nA(this,void 0,void 0,(function*(){const t=[{type:"name",content:this.name}];try{const e=yield this.getText("avatar");if(null==e)return null;for(let n=0;nt[e]))}return rA.throwError("invalid or unsupported content hash data",sp.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})}))}getText(t){return nA(this,void 0,void 0,(function*(){let e=wm(t);e=yp([dA(64),dA(e.length),e]),e.length%32!=0&&(e=yp([e,Ep("0x",32-t.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",bp(e));return null==n||"0x"===n?null:bm(n)}))}}let NA=null,IA=1;class EA extends Ig{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Kp(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch((t=>{})),this._ready().catch((t=>{}));else{const e=$p(new.target,"getNetwork")(t);e?(Kp(this,"_network",e),this.emit("network",e,null)):rA.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return nA(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||rA.throwError("no network detected",sp.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:Kp(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return WM((()=>this._ready().then((t=>t),(t=>{if(t.code!==sp.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))))}static getFormatter(){return null==NA&&(NA=new eA),NA}static getNetwork(t){return function(t){if(null==t)return null;if("number"==typeof t){for(const e in _M){const n=_M[e];if(n.chainId===t)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){const e=_M[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}const e=_M[t.name];if(!e)return"number"!=typeof t.chainId&&jM.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&jM.throwArgumentError("network chainId mismatch","network",t);let n=t._defaultProvider||null;var r;return null==n&&e._defaultProvider&&(n=(r=e._defaultProvider)&&"function"==typeof r.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:n}}(null==t?"homestead":t)}ccipReadFetch(t,e,n){return nA(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===n.length)return null;const r=t.to.toLowerCase(),i=e.toLowerCase(),o=[];for(let t=0;t=0?null:JSON.stringify({data:i,sender:r}),u=yield YM({url:a,errorPassThrough:!0},s,((t,e)=>(t.status=e.statusCode,t)));if(u.data)return u.data;const c=u.message||"unknown error";if(u.status>=400&&u.status<500)return rA.throwError(`response not found during CCIP fetch: ${c}`,sp.errors.SERVER_ERROR,{url:e,errorMessage:c});o.push(c)}return rA.throwError(`error encountered during CCIP fetch: ${o.map((t=>JSON.stringify(t))).join(", ")}`,sp.errors.SERVER_ERROR,{urls:n,errorMessages:o})}))}_getInternalBlockNumber(t){return nA(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const n=yield e;if(sA()-n.respTime<=t)return n.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=sA(),n=ty({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((t=>null),(t=>t))}).then((({blockNumber:t,networkError:r})=>{if(r)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),r;const i=sA();return(t=Dp.from(t).toNumber()){this._internalBlockNumber===n&&(this._internalBlockNumber=null)})),(yield n).blockNumber}))}poll(){return nA(this,void 0,void 0,(function*(){const t=IA++,e=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(n),this.emit("poll",t,n),n!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)rA.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",rA.makeError("network block skew detected",sp.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let t=this._emitted.block+1;t<=n;t++)this.emit("block",t);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&n-e>12&&delete this._emitted[t]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((t=>{switch(t.type){case"tx":{const n=t.hash;let r=this.getTransactionReceipt(n).then((t=>t&&null!=t.blockNumber?(this._emitted["t:"+n]=t.blockNumber,this.emit(n,t),null):null)).catch((t=>{this.emit("error",t)}));e.push(r);break}case"filter":if(!t._inflight){t._inflight=!0,-2===t._lastBlockNumber&&(t._lastBlockNumber=n-1);const r=t.filter;r.fromBlock=t._lastBlockNumber+1,r.toBlock=n;const i=r.toBlock-this._maxFilterBlockRange;i>r.fromBlock&&(r.fromBlock=i),r.fromBlock<0&&(r.fromBlock=0);const o=this.getLogs(r).then((e=>{t._inflight=!1,0!==e.length&&e.forEach((e=>{e.blockNumber>t._lastBlockNumber&&(t._lastBlockNumber=e.blockNumber),this._emitted["b:"+e.blockHash]=e.blockNumber,this._emitted["t:"+e.transactionHash]=e.blockNumber,this.emit(r,e)}))})).catch((e=>{this.emit("error",e),t._inflight=!1}));e.push(o)}}})),this._lastBlockNumber=n,Promise.all(e).then((()=>{this.emit("didPoll",t)})).catch((t=>{this.emit("error",t)}))}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return nA(this,void 0,void 0,(function*(){return rA.throwError("provider does not support network detection",sp.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return nA(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",e,t),yield uA(0),this._network;const n=rA.makeError("underlying network changed",sp.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",n),n}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((t=>{this._setFastBlockNumber(t)}),(t=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const t=sA();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&tthis._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,n){return nA(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,n||0,null)}))}_waitForTransaction(t,e,n,r){return nA(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(t);return(i?i.confirmations:0)>=e?i:new Promise(((i,o)=>{const a=[];let s=!1;const u=function(){return!!s||(s=!0,a.forEach((t=>{t()})),!1)},c=t=>{t.confirmations{this.removeListener(t,c)})),r){let n=r.startBlock,i=null;const c=a=>nA(this,void 0,void 0,(function*(){s||(yield uA(1e3),this.getTransactionCount(r.from).then((l=>nA(this,void 0,void 0,(function*(){if(!s){if(l<=r.nonce)n=a;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==i&&(i=n-3,i{s||this.once("block",c)})))}));if(s)return;this.once("block",c),a.push((()=>{this.removeListener("block",c)}))}if("number"==typeof n&&n>0){const t=setTimeout((()=>{u()||o(rA.makeError("timeout exceeded",sp.errors.TIMEOUT,{timeout:n}))}),n);t.unref&&t.unref(),a.push((()=>{clearTimeout(t)}))}}))}))}getBlockNumber(){return nA(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return Dp.from(t)}catch(e){return rA.throwError("bad result from backend",sp.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield ty({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getBalance",n);try{return Dp.from(r)}catch(t){return rA.throwError("bad result from backend",sp.errors.SERVER_ERROR,{method:"getBalance",params:n,result:r,error:t})}}))}getTransactionCount(t,e){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield ty({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getTransactionCount",n);try{return Dp.from(r).toNumber()}catch(t){return rA.throwError("bad result from backend",sp.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:r,error:t})}}))}getCode(t,e){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield ty({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getCode",n);try{return bp(r)}catch(t){return rA.throwError("bad result from backend",sp.errors.SERVER_ERROR,{method:"getCode",params:n,result:r,error:t})}}))}getStorageAt(t,e,n){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield ty({address:this._getAddress(t),blockTag:this._getBlockTag(n),position:Promise.resolve(e).then((t=>Ip(t)))}),i=yield this.perform("getStorageAt",r);try{return bp(i)}catch(t){return rA.throwError("bad result from backend",sp.errors.SERVER_ERROR,{method:"getStorageAt",params:r,result:i,error:t})}}))}_wrapTransaction(t,e,n){if(null!=e&&32!==Mp(e))throw new Error("invalid response - sendTransaction");const r=t;return null!=e&&t.hash!==e&&rA.throwError("Transaction hash mismatch from Provider.sendTransaction.",sp.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),r.wait=(e,r)=>nA(this,void 0,void 0,(function*(){let i;null==e&&(e=1),null==r&&(r=0),0!==e&&null!=n&&(i={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:n});const o=yield this._waitForTransaction(t.hash,e,r,i);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&rA.throwError("transaction failed",sp.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),r}sendTransaction(t){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then((t=>bp(t))),n=this.formatter.transaction(t);null==n.confirmations&&(n.confirmations=0);const r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(n,t,r)}catch(t){throw t.transaction=n,t.transactionHash=n.hash,t}}))}_getTransactionRequest(t){return nA(this,void 0,void 0,(function*(){const e=yield t,n={};return["from","to"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?this._getAddress(t):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?Dp.from(t):null)))})),["type"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>null!=t?t:null)))})),e.accessList&&(n.accessList=this.formatter.accessList(e.accessList)),["data"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?bp(t):null)))})),this.formatter.transactionRequest(yield ty(n))}))}_getFilter(t){return nA(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach((n=>{null!=t[n]&&(e[n]=t[n])})),["fromBlock","toBlock"].forEach((n=>{null!=t[n]&&(e[n]=this._getBlockTag(t[n]))})),this.formatter.filter(yield ty(e))}))}_call(t,e,n){return nA(this,void 0,void 0,(function*(){n>=10&&rA.throwError("CCIP read exceeded maximum redirections",sp.errors.SERVER_ERROR,{redirects:n,transaction:t});const r=t.to,i=yield this.perform("call",{transaction:t,blockTag:e});if(n>=0&&"latest"===e&&null!=r&&"0x556f1830"===i.substring(0,10)&&Mp(i)%32==4)try{const o=Ap(i,4),a=Ap(o,0,32);Dp.from(a).eq(r)||rA.throwError("CCIP Read sender did not match",sp.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i});const s=[],u=Dp.from(Ap(o,32,64)).toNumber(),c=Dp.from(Ap(o,u,u+32)).toNumber(),l=Ap(o,u+32);for(let e=0;enA(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",r);if(null==t)return null!=r.blockHash&&null==this._emitted["b:"+r.blockHash]||null!=r.blockTag&&n>this._emitted.block?null:void 0;if(e){let e=null;for(let n=0;nthis._wrapTransaction(t))),n}return this.formatter.block(t)}))),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return nA(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return WM((()=>nA(this,void 0,void 0,(function*(){const n=yield this.perform("getTransaction",e);if(null==n)return null==this._emitted["t:"+t]?null:void 0;const r=this.formatter.transactionResponse(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;t<=0&&(t=1),r.confirmations=t}return this._wrapTransaction(r)}))),{oncePoll:this})}))}getTransactionReceipt(t){return nA(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return WM((()=>nA(this,void 0,void 0,(function*(){const n=yield this.perform("getTransactionReceipt",e);if(null==n)return null==this._emitted["t:"+t]?null:void 0;if(null==n.blockHash)return;const r=this.formatter.receipt(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;t<=0&&(t=1),r.confirmations=t}return r}))),{oncePoll:this})}))}getLogs(t){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield ty({filter:this._getFilter(t)}),n=yield this.perform("getLogs",e);return n.forEach((t=>{null==t.removed&&(t.removed=!1)})),eA.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)}))}getEtherPrice(){return nA(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return nA(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&rA.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return nA(this,void 0,void 0,(function*(){let e=t;for(;;){if(""===e||"."===e)return null;if("eth"!==t&&"eth"===e)return null;const n=yield this._getResolver(e,"getResolver");if(null!=n){const r=new AA(this,n,t);return e===t||(yield r.supportsWildcard())?r:null}e=e.split(".").slice(1).join(".")}}))}_getResolver(t,e){return nA(this,void 0,void 0,(function*(){null==e&&(e="ENS");const n=yield this.getNetwork();n.ensAddress||rA.throwError("network does not support ENS",sp.errors.UNSUPPORTED_OPERATION,{operation:e,network:n.name});try{const e=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+Km(t).substring(2)});return this.formatter.callAddress(e)}catch(t){}return null}))}resolveName(t){return nA(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if(vp(t))throw e}"string"!=typeof t&&rA.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return nA(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(e,"lookupAddress");if(null==n)return null;const r=mA(yield this.call({to:n,data:"0x691f3431"+Km(e).substring(2)}),0);return(yield this.resolveName(r))!=t?null:r}))}getAvatar(t){return nA(this,void 0,void 0,(function*(){let e=null;if(vp(t)){const n=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(n,"getAvatar");if(!r)return null;e=new AA(this,r,n);try{const t=yield e.getAvatar();if(t)return t.url}catch(t){if(t.code!==sp.errors.CALL_EXCEPTION)throw t}try{const t=mA(yield this.call({to:r,data:"0x691f3431"+Km(n).substring(2)}),0);e=yield this.getResolver(t)}catch(t){if(t.code!==sp.errors.CALL_EXCEPTION)throw t;return null}}else if(e=yield this.getResolver(t),!e)return null;const n=yield e.getAvatar();return null==n?null:n.url}))}perform(t,e){return rA.throwError(t+" not implemented",sp.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_stopEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_addEventListener(t,e,n){const r=new lA(aA(t),e,n);return this._events.push(r),this._startEvent(r),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let n=!1,r=[],i=aA(t);return this._events=this._events.filter((t=>t.tag!==i||(setTimeout((()=>{t.listener.apply(this,e)}),0),n=!0,!t.once||(r.push(t),!1)))),r.forEach((t=>{this._stopEvent(t)})),n}listenerCount(t){if(!t)return this._events.length;let e=aA(t);return this._events.filter((t=>t.tag===e)).length}listeners(t){if(null==t)return this._events.map((t=>t.listener));let e=aA(t);return this._events.filter((t=>t.tag===e)).map((t=>t.listener))}off(t,e){if(null==e)return this.removeAllListeners(t);const n=[];let r=!1,i=aA(t);return this._events=this._events.filter((t=>t.tag!==i||t.listener!=e||!!r||(r=!0,n.push(t),!1))),n.forEach((t=>{this._stopEvent(t)})),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const n=aA(t);this._events=this._events.filter((t=>t.tag!==n||(e.push(t),!1)))}return e.forEach((t=>{this._stopEvent(t)})),this}}var xA=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const kA=new sp($M),TA=["call","estimateGas"];function LA(t,e){if(null==t)return null;if("string"==typeof t.message&&t.message.match("reverted")){const n=vp(t.data)?t.data:null;if(!e||n)return{message:t.message,data:n}}if("object"==typeof t){for(const n in t){const r=LA(t[n],e);if(r)return r}return null}if("string"==typeof t)try{return LA(JSON.parse(t),e)}catch(t){}return null}function SA(t,e,n){const r=n.transaction||n.signedTransaction;if("call"===t){const t=LA(e,!0);if(t)return t.data;kA.throwError("missing revert data in call exception; Transaction reverted without a reason string",sp.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if("estimateGas"===t){let n=LA(e.body,!1);null==n&&(n=LA(e,!1)),n&&kA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",sp.errors.UNPREDICTABLE_GAS_LIMIT,{reason:n.message,method:t,transaction:r,error:e})}let i=e.message;throw e.code===sp.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?i=e.error.message:"string"==typeof e.body?i=e.body:"string"==typeof e.responseText&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&kA.throwError("insufficient funds for intrinsic transaction cost",sp.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),i.match(/nonce (is )?too low/i)&&kA.throwError("nonce has already been used",sp.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&kA.throwError("replacement fee too low",sp.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),i.match(/only replay-protected/i)&&kA.throwError("legacy pre-eip-155 transactions not supported",sp.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:r}),TA.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&kA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",sp.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}function jA(t){return new Promise((function(e){setTimeout(e,t)}))}function CA(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function DA(t){return t?t.toLowerCase():t}const OA={};class zA extends Lg{constructor(t,e,n){if(super(),t!==OA)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Kp(this,"provider",e),null==n&&(n=0),"string"==typeof n?(Kp(this,"_address",this.provider.formatter.address(n)),Kp(this,"_index",null)):"number"==typeof n?(Kp(this,"_index",n),Kp(this,"_address",null)):kA.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(t){return kA.throwError("cannot alter JSON-RPC Signer connection",sp.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new PA(OA,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((t=>(t.length<=this._index&&kA.throwError("unknown account #"+this._index,sp.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index]))))}sendUncheckedTransaction(t){t=ey(t);const e=this.getAddress().then((t=>(t&&(t=t.toLowerCase()),t)));if(null==t.gasLimit){const n=ey(t);n.from=e,t.gasLimit=this.provider.estimateGas(n)}return null!=t.to&&(t.to=Promise.resolve(t.to).then((t=>xA(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.provider.resolveName(t);return null==e&&kA.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))))),ty({tx:ty(t),sender:e}).then((({tx:e,sender:n})=>{null!=e.from?e.from.toLowerCase()!==n&&kA.throwArgumentError("from address mismatch","transaction",t):e.from=n;const r=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[r]).then((t=>t),(t=>("string"==typeof t.message&&t.message.match(/user denied/i)&&kA.throwError("user rejected transaction",sp.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:e}),SA("sendTransaction",t,r))))}))}signTransaction(t){return kA.throwError("signing transactions is unsupported",sp.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return xA(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(t);try{return yield WM((()=>xA(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(n);if(null!==t)return this.provider._wrapTransaction(t,n,e)}))),{oncePoll:this.provider})}catch(t){throw t.transactionHash=n,t}}))}signMessage(t){return xA(this,void 0,void 0,(function*(){const e="string"==typeof t?wm(t):t,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[bp(e),n.toLowerCase()])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&kA.throwError("user rejected signing",sp.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:t}),e}}))}_legacySignMessage(t){return xA(this,void 0,void 0,(function*(){const e="string"==typeof t?wm(t):t,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),bp(e)])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&kA.throwError("user rejected signing",sp.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:t}),e}}))}_signTypedData(t,e,n){return xA(this,void 0,void 0,(function*(){const r=yield fg.resolveNames(t,e,n,(t=>this.provider.resolveName(t))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(fg.getPayload(r.domain,e,r.value))])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&kA.throwError("user rejected signing",sp.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:r.domain,types:e,value:r.value}}),t}}))}unlock(t){return xA(this,void 0,void 0,(function*(){const e=this.provider,n=yield this.getAddress();return e.send("personal_unlockAccount",[n.toLowerCase(),t,null])}))}}class PA extends zA{sendTransaction(t){return this.sendUncheckedTransaction(t).then((t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)})))}}const _A={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class BA extends EA{constructor(t,e){let n=e;null==n&&(n=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then((e=>{t(e)}),(t=>{e(t)}))}),0)}))),super(n),t||(t=$p(this.constructor,"defaultUrl")()),Kp(this,"connection","string"==typeof t?Object.freeze({url:t}):Object.freeze(ey(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return xA(this,void 0,void 0,(function*(){yield jA(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=$p(this.constructor,"getNetwork");try{return e(Dp.from(t).toNumber())}catch(e){return kA.throwError("could not detect network",sp.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return kA.throwError("could not detect network",sp.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new zA(OA,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((t=>t.map((t=>this.formatter.address(t)))))}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:oy(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(r&&this._cache[t])return this._cache[t];const i=YM(this.connection,JSON.stringify(n),CA).then((t=>(this.emit("debug",{action:"response",request:n,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:n,provider:this}),t}));return r&&(this._cache[t]=i,setTimeout((()=>{this._cache[t]=null}),0)),i}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[DA(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[DA(e.address),e.blockTag]];case"getCode":return["eth_getCode",[DA(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[DA(e.address),Ep(e.position,32),e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[$p(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[$p(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=DA(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return xA(this,void 0,void 0,(function*(){if("call"===t||"estimateGas"===t){const t=e.transaction;if(t&&null!=t.type&&Dp.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const n=yield this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&((e=ey(e)).transaction=ey(t),delete e.transaction.type)}}const n=this.prepareRequest(t,e);null==n&&kA.throwError(t+" not implemented",sp.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(n[0],n[1])}catch(n){return SA(t,n,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(n){return function r(){t.send("eth_getFilterChanges",[n]).then((function(n){if(t._pendingFilter!=e)return null;let r=Promise.resolve();return n.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",r=r.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),r.then((function(){return jA(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){r()}),0),null;t.send("eth_uninstallFilter",[n])})).catch((t=>{}))}(),n})).catch((t=>{}))}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const n=ey(_A);if(e)for(const t in e)e[t]&&(n[t]=!0);var r,i;i=n,(r=t)&&"object"==typeof r||Xp.throwArgumentError("invalid object","object",r),Object.keys(r).forEach((t=>{i[t]||Xp.throwArgumentError("invalid object key - "+t,"transaction:"+t,r)}));const o={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(e){if(null==t[e])return;const n=Ip(Dp.from(t[e]));"gasLimit"===e&&(e="gas"),o[e]=n})),["from","to","data"].forEach((function(e){null!=t[e]&&(o[e]=bp(t[e]))})),t.accessList&&(o.accessList=lM(t.accessList)),o}}const RA=new sp($M);let UA=1;function QA(t,e){const n="Web3LegacyFetcher";return function(t,r){const i={method:t,params:r,id:UA++,jsonrpc:"2.0"};return new Promise(((t,r)=>{this.emit("debug",{action:"request",fetcher:n,request:oy(i),provider:this}),e(i,((e,o)=>{if(e)return this.emit("debug",{action:"response",fetcher:n,error:e,request:i,provider:this}),r(e);if(this.emit("debug",{action:"response",fetcher:n,request:i,response:o,provider:this}),o.error){const t=new Error(o.error.message);return t.code=o.error.code,t.data=o.error.data,r(t)}t(o.result)}))}))}}class YA extends BA{constructor(t,e){null==t&&RA.throwArgumentError("missing provider","provider",t);let n=null,r=null,i=null;"function"==typeof t?(n="unknown:",r=t):(n=t.host||t.path||"",!n&&t.isMetaMask&&(n="metamask"),i=t,t.request?(""===n&&(n="eip-1193:"),r=function(t){return function(e,n){null==n&&(n=[]);const r={method:e,params:n};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:oy(r),provider:this}),t.request(r).then((t=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:t,provider:this}),t}))}}(t)):t.sendAsync?r=QA(0,t.sendAsync.bind(t)):t.send?r=QA(0,t.send.bind(t)):RA.throwArgumentError("unsupported provider","provider",t),n||(n="unknown:")),super(n,e),Kp(this,"jsonRpcFetchFunc",r),Kp(this,"provider",i)}send(t,e){return this.jsonRpcFetchFunc(t,e)}}const WA=new RegExp("^bytes([0-9]+)$"),FA=new RegExp("^(u?int)([0-9]*)$"),VA=new RegExp("^(.*)\\[([0-9]*)\\]$"),HA=new sp("solidity/5.7.0");function GA(t,e,n){switch(t){case"address":return n?gp(e,32):pp(e);case"string":return wm(e);case"bytes":return pp(e);case"bool":return e=e?"0x01":"0x00",n?gp(e,32):pp(e)}let r=t.match(FA);if(r){let i=parseInt(r[2]||"256");return(r[2]&&String(i)!==r[2]||i%8!=0||0===i||i>256)&&HA.throwArgumentError("invalid number type","type",t),n&&(i=256),gp(e=Dp.from(e).toTwos(i),i/8)}if(r=t.match(WA),r){const i=parseInt(r[1]);return(String(i)!==r[1]||0===i||i>32)&&HA.throwArgumentError("invalid bytes type","type",t),pp(e).byteLength!==i&&HA.throwArgumentError(`invalid value for ${t}`,"value",e),n?pp((e+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):e}if(r=t.match(VA),r&&Array.isArray(e)){const n=r[1];parseInt(r[2]||String(e.length))!=e.length&&HA.throwArgumentError(`invalid array length for ${t}`,"value",e);const i=[];return e.forEach((function(t){i.push(GA(n,t,!0))})),yp(i)}return HA.throwArgumentError("invalid type","type",t)}function qA(t,e){t.length!=e.length&&HA.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const n=[];return t.forEach((function(t,r){n.push(GA(t,e[r]))})),bp(yp(n))}const ZA=new sp("units/5.7.0"),JA=["wei","kwei","mwei","gwei","szabo","finney","ether"];function XA(t,e){if("string"==typeof e){const t=JA.indexOf(e);-1!==t&&(e=3*t)}return Vp(t,null!=e?e:18)}function KA(t,e){if("string"!=typeof t&&ZA.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=JA.indexOf(e);-1!==t&&(e=3*t)}return Hp(t,null!=e?e:18)}let $A,tN=()=>$A||($A="object"==typeof r?r:window,$A);const eN=()=>(void 0===tN()._Web3ClientConfiguration&&(tN()._Web3ClientConfiguration={}),tN()._Web3ClientConfiguration);function nN(t){let e,n=t[0],r=1;for(;rn.call(e,...t))),e=void 0)}return n}class rN extends BA{constructor(t,e,n,r){super(t),this._network=e,this._endpoint=t,this._endpoints=n,this._failover=r,this._pendingBatch=[]}detectNetwork(){return Promise.resolve(zf.findByName(this._network).id)}requestChunk(t,e){try{const n=t.map((t=>t.request));return YM(e,JSON.stringify(n)).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(nN([r,"optionalAccess",t=>t.error])){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else nN([r,"optionalAccess",t=>t.result])?t.resolve(r.result):t.reject()}))})).catch((e=>{if(e&&"SERVER_ERROR"==e.code){const e=this._endpoints.indexOf(this._endpoint)+1;this._failover(),this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this.requestChunk(t,this._endpoint)}else t.forEach((t=>{t.reject(e)}))}))}catch(e){t.forEach((t=>{t.reject()}))}}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const e=[];for(let n=0;n(t.map((t=>t.request)),this.requestChunk(t,this._endpoint))))}),eN().batchInterval||10)),i}}const iN=()=>(null==tN()._Web3ClientProviders&&(tN()._Web3ClientProviders={}),tN()._Web3ClientProviders),oN=(t,e)=>{void 0===iN()[t]&&(iN()[t]=[]);const n=iN()[t].indexOf(e);n>-1&&iN()[t].splice(n,1),iN()[t].unshift(e)},aN=async(t,e,n=!0)=>{let r;iN()[t]=e.map(((r,i)=>new rN(r,t,e,(()=>{1===iN()[t].length?aN(t,e,n):iN()[t].splice(i,1)}))));let i=tN();if(null==i.fetch||void 0!==k&&k.env&&"test"==k.env.NODE_ENV||void 0!==i.cy||!1===n)r=iN()[t][0];else{let n=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();if(setTimeout((()=>e(900)),900),!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},referrer:"",referrerPolicy:"no-referrer",body:JSON.stringify({method:"net_version",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const i=Math.min(...n),o=n.indexOf(i);r=iN()[t][o]}oN(t,r)};var sN={getProvider:async t=>{let e=iN();if(e&&e[t])return e[t][0];let n=tN();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[t]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[t]=new Promise((async e=>{await aN(t,zf[t].endpoints),e(tN()._Web3ClientProviders[t][0])}))),await n._Web3ClientGetProviderPromise[t]},getProviders:async t=>{let e=iN();if(e&&e[t])return e[t];let n=tN();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[t]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[t]=new Promise((async e=>{await aN(t,zf[t].endpoints),e(tN()._Web3ClientProviders[t])}))),await n._Web3ClientGetProvidersPromise[t]},setProviderEndpoints:aN,setProvider:oN};class uN extends Ql{constructor(t,e,n,r){super(t),this._provider=new Ql(t),this._network=e,this._endpoint=t,this._endpoints=n,this._failover=r,this._pendingBatch=[],this._rpcRequest=this._rpcRequestReplacement.bind(this)}requestChunk(t){const e=t.map((t=>t.request)),n=e=>{if(e&&["Failed to fetch","limit reached","504","503","502","500","429","426","422","413","409","408","406","405","404","403","402","401","400"].some((t=>e.toString().match(t)))){const e=this._endpoints.indexOf(this._endpoint)+1;this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this._provider=new Ql(this._endpoint),this.requestChunk(t)}else t.forEach((t=>{t.reject(e)}))};try{return this._provider._rpcBatchRequest(e).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(function(t){let e,n=t[0],r=1;for(;rn.call(e,...t))),e=void 0)}return n}([r,"optionalAccess",t=>t.error])){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else r?t.resolve(r):t.reject()}))})).catch(n)}catch(t){return n(t)}}_rpcRequestReplacement(t,e){const n={methodName:t,args:e};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const e=[];for(let n=0;n(t.map((t=>t.request)),this.requestChunk(t))))}),eN().batchInterval||10)),i}}const cN=()=>(null==tN()._Web3ClientProviders&&(tN()._Web3ClientProviders={}),tN()._Web3ClientProviders),lN=(t,e)=>{void 0===cN()[t]&&(cN()[t]=[]);const n=cN()[t].indexOf(e);n>-1&&cN()[t].splice(n,1),cN()[t].unshift(e)},hN=async(t,e,n=!0)=>{let r;cN()[t]=e.map(((r,i)=>new uN(r,t,e,(()=>{1===cN()[t].length?hN(t,e,n):cN()[t].splice(i,1)}))));let i=tN();if(null==i.fetch||void 0!==k&&k.env&&"test"==k.env.NODE_ENV||void 0!==i.cy||!1===n)r=cN()[t][0];else{let n=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();if(setTimeout((()=>e(900)),900),!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},referrer:"",referrerPolicy:"no-referrer",body:JSON.stringify({method:"getIdentity",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const i=Math.min(...n),o=n.indexOf(i);r=cN()[t][o]}lN(t,r)};var dN={getProvider:async t=>{let e=cN();if(e&&e[t])return e[t][0];let n=tN();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[t]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[t]=new Promise((async e=>{await hN(t,zf[t].endpoints),e(tN()._Web3ClientProviders[t][0])}))),await n._Web3ClientGetProviderPromise[t]},getProviders:async t=>{let e=cN();if(e&&e[t])return e[t];let n=tN();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[t]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[t]=new Promise((async e=>{await hN(t,zf[t].endpoints),e(tN()._Web3ClientProviders[t])}))),await n._Web3ClientGetProvidersPromise[t]},setProviderEndpoints:hN,setProvider:lN};let fN=["ethereum","bsc","polygon","solana","fantom","arbitrum","avalanche","gnosis","optimism","base"];fN.evm=["ethereum","bsc","polygon","fantom","arbitrum","avalanche","gnosis","optimism","base"],fN.solana=["solana"];let pN=()=>(null==tN()._Web3ClientCacheStore&&(tN()._Web3ClientCacheStore={}),tN()._Web3ClientCacheStore),yN=()=>(null==tN()._Web3ClientPromiseStore&&(tN()._Web3ClientPromiseStore={}),tN()._Web3ClientPromiseStore),mN=function({key:t}){yN()[t]=void 0},gN=function({call:t,key:e,expires:n=0}){return new Promise(((r,i)=>{let o,a=function({key:t}){return yN()[t]}({key:e=JSON.stringify(e)});if(a)return a.then(r).catch(i);(function({key:t,promise:e}){return yN()[t]=e,e})({key:e,promise:new Promise(((a,s)=>0===n?t().then((t=>{r(t),a(t)})).catch((t=>{i(t),s(t)})):(o=function({key:t,expires:e}){let n=pN()[t];if(function(t){let e,n=t[0],r=1;for(;rn.call(e,...t))),e=void 0)}return n}([n,"optionalAccess",t=>t.expiresAt])>Date.now())return n.value}({key:e,expires:n}),o?(r(o),a(o),o):void t().then((t=>{t&&function({key:t,value:e,expires:n}){pN()[t]={expiresAt:Date.now()+n,value:e}}({key:e,value:t,expires:n}),r(t),a(t)})).catch((t=>{i(t),s(t)})))))}).then((()=>{mN({key:e})})).catch((()=>{mN({key:e})}))}))};const vN=async t=>{if(fN.evm.includes(t))return await sN.getProvider(t);if(fN.solana.includes(t))return await dN.getProvider(t);throw"Unknown blockchain: "+t},wN=t=>`(${t.map((t=>"tuple"===t.type?wN(t.components):t.type)).join(",")})`;let bN=async function({blockchain:t,from:e,to:n,value:r,method:i,api:o,params:a,cache:s}){if(!fN.includes(t))throw"Unknown blockchain: "+t;void 0===r&&(r="0");const u=await vN(t);return await gN({expires:s||0,key:[t,e,n,r,i,a],call:async()=>(({provider:t,from:e,to:n,value:r,method:i,api:o,params:a})=>{if(void 0===o)return t.estimateGas({from:e,to:n,value:r});{let s=new kM(n,o,t),u=s.interface.fragments.find((t=>t.name==i)),c=(({contract:t,method:e,params:n})=>{let r=t.interface.fragments.find((t=>t.name==e));return n instanceof Array?n:n instanceof Object?r.inputs.map((t=>n[t.name])):void 0})({contract:s,method:i,params:a});void 0===s[i]&&(i=`${i}(${u.inputs.map((t=>"tuple"===t.type?wN(t.components):t.type)).join(",")})`);let l=s.estimateGas[i];return c?l(...c,{from:e,value:r}):l({from:e,value:r})}})({provider:u,from:e,to:n,value:r,method:i,api:o,params:a})})};const MN=({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a})=>n?(({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=new kM(t,e,i),s=(({contract:t,method:e,params:n})=>t.interface.fragments.find((t=>t.name==e)).inputs.map(((t,e)=>Array.isArray(n)?n[e]:n[t.name])))({contract:a,method:n,params:r}),u=a.interface.fragments.find((t=>t.name===n));return void 0===a[n]&&(n=`${n}(${u.inputs.map((t=>t.type)).join(",")})`),u&&"nonpayable"===u.stateMutability?a.callStatic[n](...s,{blockTag:o}):a[n](...s,{blockTag:o})})({address:e,api:n,method:r,params:i,provider:a,block:o}):"latestBlockNumber"===r?a.getBlockNumber():"balance"===r?(({address:t,provider:e})=>e.getBalance(t))({address:e,provider:a}):"transactionCount"===r?(({address:t,provider:e})=>e.getTransactionCount(t))({address:e,provider:a}):void 0,AN=async({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a,providers:s})=>{try{if(null==r||"getAccountInfo"===r)return null==n&&(n=Hd),await(async({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=await i.getAccountInfo(new Ws(t));if(a&&a.data)return e.decode(a.data)})({address:e,api:n,method:r,params:i,provider:a,block:o});if("getProgramAccounts"===r)return await a.getProgramAccounts(new Ws(e),i).then((t=>n?t.map((t=>(t.data=n.decode(t.account.data),t))):t));if("getTokenAccountBalance"===r)return await a.getTokenAccountBalance(new Ws(e));if("latestBlockNumber"===r)return await a.getSlot(i||void 0);if("balance"===r)return await(({address:t,provider:e})=>e.getBalance(new Ws(t)))({address:e,provider:a})}catch(u){if(s&&u&&["Failed to fetch","limit reached","504","503","502","500","429","426","422","413","409","408","406","405","404","403","402","401","400"].some((t=>u.toString().match(t)))){let u=s[s.indexOf(a)+1]||s[0];return AN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:u,providers:s})}throw u}},NN=async function(t,e){const{blockchain:n,address:r,method:i}=(t=>{if("object"==typeof t)return t;let e=t.match(/(?\w+):\/\/(?[\w\d]+)(\/(?[\w\d]+)*)?/);return null==e.groups.part2?e.groups.part1.match(/\d/)?{blockchain:e.groups.blockchain,address:e.groups.part1}:{blockchain:e.groups.blockchain,method:e.groups.part1}:{blockchain:e.groups.blockchain,address:e.groups.part1,method:e.groups.part2}})(t),{api:o,params:a,cache:s,block:u,timeout:c,strategy:l,cacheKey:h}=("object"==typeof t?t:e)||{};return await gN({expires:s||0,key:h||[n,r,i,a,u],call:async()=>{if(fN.evm.includes(n))return await(async({blockchain:t,address:e,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{if(s=s||eN().strategy||"failover",a=a||eN().timeout||void 0,"fastest"===s){const s=await sN.getProviders(t);let u=[];const c=s.map((a=>new Promise((s=>{u.push(MN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a}).then(s))})))),l=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a||1e4)));return u=Promise.all(u.map((t=>new Promise((e=>{t.catch(e)}))))).then((()=>{})),Promise.race([...c,l,u])}{const s=await sN.getProvider(t),u=MN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:s});return a?(a=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a))),Promise.race([u,a])):u}})({blockchain:n,address:r,api:o,method:i,params:a,block:u,strategy:l,timeout:c});if(fN.solana.includes(n))return await(async({blockchain:t,address:e,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{s=s||eN().strategy||"failover",a=a||eN().timeout||void 0;const u=await dN.getProviders(t);if("fastest"===s){let s=[];const c=u.map((a=>new Promise((u=>{s.push(AN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a}).then(u))})))),l=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a||1e4)));return s=Promise.all(s.map((t=>new Promise((e=>{t.catch(e)}))))).then((()=>{})),Promise.race([...c,l,s])}{const s=await dN.getProvider(t),c=AN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:s,providers:u});return a?(a=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a))),Promise.race([c,a])):c}})({blockchain:n,address:r,api:o,method:i,params:a,block:u,strategy:l,timeout:c});throw"Unknown blockchain: "+n}})};var IN=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.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 i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));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=128)}([function(t,e,n){(function(t,r,i){n.d(e,"a",(function(){return Ji})),n.d(e,"b",(function(){return ha})),n.d(e,"c",(function(){return $i})),n.d(e,"d",(function(){return To})),n.d(e,"e",(function(){return ot})),n.d(e,"f",(function(){return $})),n.d(e,"g",(function(){return Vi})),n.d(e,"h",(function(){return tt})),n.d(e,"i",(function(){return oo})),n.d(e,"j",(function(){return so})),n.d(e,"k",(function(){return no})),n.d(e,"l",(function(){return uo})),n.d(e,"m",(function(){return ao})),n.d(e,"n",(function(){return st})),n.d(e,"o",(function(){return rt})),n.d(e,"p",(function(){return Ui})),n.d(e,"q",(function(){return Z})),n.d(e,"r",(function(){return nt})),n.d(e,"s",(function(){return xo})),n.d(e,"t",(function(){return to})),n.d(e,"u",(function(){return eo})),n.d(e,"v",(function(){return G})),n.d(e,"w",(function(){return H})),n.d(e,"x",(function(){return qi})),n.d(e,"y",(function(){return lt})),n.d(e,"z",(function(){return Bi})),n.d(e,"A",(function(){return jo})),n.d(e,"B",(function(){return Gi})),n.d(e,"C",(function(){return _i})),n.d(e,"D",(function(){return Zi})),n.d(e,"E",(function(){return po})),n.d(e,"F",(function(){return fo})),n.d(e,"G",(function(){return Co})),n.d(e,"H",(function(){return ct})),n.d(e,"I",(function(){return ro})),n.d(e,"J",(function(){return io})),n.d(e,"K",(function(){return F})),n.d(e,"L",(function(){return oa})),n.d(e,"M",(function(){return at})),n.d(e,"N",(function(){return Y})),n.d(e,"O",(function(){return ua})),n.d(e,"P",(function(){return Qo})),n.d(e,"Q",(function(){return W})),n.d(e,"R",(function(){return Bo})),n.d(e,"S",(function(){return Yo})),n.d(e,"T",(function(){return ho})),n.d(e,"U",(function(){return zo})),n.d(e,"V",(function(){return Do})),n.d(e,"W",(function(){return Wo})),n.d(e,"X",(function(){return Ko})),n.d(e,"Y",(function(){return ea})),n.d(e,"Z",(function(){return Jo})),n.d(e,"ab",(function(){return Go})),n.d(e,"bb",(function(){return na})),n.d(e,"cb",(function(){return ia})),n.d(e,"db",(function(){return ra})),n.d(e,"eb",(function(){return Oo})),n.d(e,"fb",(function(){return Xo})),n.d(e,"gb",(function(){return qo})),n.d(e,"hb",(function(){return Zo})),n.d(e,"ib",(function(){return $o})),n.d(e,"jb",(function(){return sa})),n.d(e,"kb",(function(){return Ho})),n.d(e,"lb",(function(){return ta})),n.d(e,"mb",(function(){return Po})),n.d(e,"nb",(function(){return Uo})),n.d(e,"ob",(function(){return X})),n.d(e,"pb",(function(){return Hi})),n.d(e,"qb",(function(){return K})),n.d(e,"rb",(function(){return S})),n.d(e,"sb",(function(){return it})),n.d(e,"tb",(function(){return Io})),n.d(e,"ub",(function(){return ca})),n.d(e,"vb",(function(){return co})),n.d(e,"wb",(function(){return lo})),n.d(e,"xb",(function(){return Ri}));var o=n(71),a=n(1),s=n(21),u=n(68),c=n(32),l=n(43),h=n(69),d=n(24),f=n(38),p=n(44),y=n(5),m=n(70);function g(t,e,n){return(e=M(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){for(var n=0;n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function N(t){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function I(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=k(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function E(t){return function(t){if(Array.isArray(t))return T(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||k(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(t,e)||k(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(t,e){if(t){if("string"==typeof t)return T(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T(t,e):void 0}}function T(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:a.FIVE_MINUTES,i=arguments.length>1?arguments[1]:void 0,o=Object(a.toMiliseconds)(r||a.FIVE_MINUTES);return{resolve:function(e){n&&t&&(clearTimeout(n),t(e))},reject:function(t){n&&e&&(clearTimeout(n),e(t))},done:function(){return new Promise((function(r,a){n=setTimeout((function(){a(new Error(i))}),o),t=r,e=a}))}}}function tt(t,e,n){var r=this;return new Promise((function(i,o){return L(r,null,A().mark((function r(){var a,s;return A().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=setTimeout((function(){return o(new Error(n))}),e),r.prev=1,r.next=4,t;case 4:s=r.sent,i(s),r.next=11;break;case 8:r.prev=8,r.t0=r.catch(1),o(r.t0);case 11:clearTimeout(a);case 12:case"end":return r.stop()}}),r,null,[[1,8]])})))}))}function et(t,e){if("string"==typeof e&&e.startsWith("".concat(t,":")))return e;if("topic"===t.toLowerCase()){if("string"!=typeof e)throw new Error('Value must be "string" for expirer target type: topic');return"topic:".concat(e)}if("id"===t.toLowerCase()){if("number"!=typeof e)throw new Error('Value must be "number" for expirer target type: id');return"id:".concat(e)}throw new Error("Unknown expirer target type: ".concat(t))}function nt(t){return et("topic",t)}function rt(t){return et("id",t)}function it(t){var e=x(t.split(":"),2),n=e[0],r=e[1],i={id:void 0,topic:void 0};if("topic"===n&&"string"==typeof r)i.topic=r;else{if("id"!==n||!Number.isInteger(Number(r)))throw new Error("Invalid target, expected id:number or topic:string, got ".concat(n,":").concat(r));i.id=Number(r)}return i}function ot(t,e){return Object(a.fromMiliseconds)((e||Date.now())+Object(a.toMiliseconds)(t))}function at(t){return Date.now()>=Object(a.toMiliseconds)(t)}function st(t,e){return"".concat(t).concat(e?":".concat(e):"")}function ut(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return E(new Set([].concat(E(t),E(e))))}function ct(t){return L(this,arguments,(function(t){var e=t.id,n=t.topic,i=t.wcDeepLink;return A().mark((function t(){var o,a,s,u;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,i){t.next=3;break}return t.abrupt("return");case 3:if(o="string"==typeof i?JSON.parse(i):i,"string"==typeof(a=null==o?void 0:o.href)){t.next=7;break}return t.abrupt("return");case 7:if(a.endsWith("/")&&(a=a.slice(0,-1)),s="".concat(a,"/wc?requestId=").concat(e,"&sessionTopic=").concat(n),(u=V())!==U){t.next=13;break}s.startsWith("https://")||s.startsWith("http://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"),t.next=17;break;case 13:if(t.t0=u===B&&N(null==r?void 0:r.Linking)<"u",!t.t0){t.next=17;break}return t.next=17,r.Linking.openURL(s);case 17:t.next=22;break;case 19:t.prev=19,t.t1=t.catch(0),console.error(t.t1);case 22:case"end":return t.stop()}}),t,null,[[0,19]])}))()}))}function lt(t,e){return L(this,null,A().mark((function n(){return A().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,t.getItem(e);case 3:if(n.t0=n.sent,n.t0){n.next=6;break}n.t0=F()?localStorage.getItem(e):void 0;case 6:return n.abrupt("return",n.t0);case 9:n.prev=9,n.t1=n.catch(0),console.error(n.t1);case 12:case"end":return n.stop()}}),n,null,[[0,9]])})))}var ht=("undefined"==typeof globalThis?"undefined":N(globalThis))<"u"?globalThis:("undefined"==typeof window?"undefined":N(window))<"u"?window:(void 0===r?"undefined":N(r))<"u"?r:("undefined"==typeof self?"undefined":N(self))<"u"?self:{},dt={exports:{}};!function(e){!function(){var n="input is invalid type",r="object"==("undefined"==typeof window?"undefined":N(window)),i=r?window:{};i.JS_SHA3_NO_WINDOW&&(r=!1);var o=!r&&"object"==("undefined"==typeof self?"undefined":N(self));!i.JS_SHA3_NO_NODE_JS&&"object"==(void 0===t?"undefined":N(t))&&t.versions&&t.versions.node?i=ht:o&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&e.exports,s=!i.JS_SHA3_NO_ARRAY_BUFFER&&("undefined"==typeof ArrayBuffer?"undefined":N(ArrayBuffer))<"u",u="0123456789abcdef".split(""),c=[4,1024,262144,67108864],l=[0,8,16,24],h=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],f=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],y={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),s&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return"object"==N(t)&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var m=function(t,e,n){return function(r){return new C(t,e,t).update(r)[n]()}},g=function(t,e,n){return function(r,i){return new C(t,e,i).update(r)[n]()}},v=function(t,e,n){return function(e,r,i,o){return I["cshake"+t].update(e,r,i,o)[n]()}},w=function(t,e,n){return function(e,r,i,o){return I["kmac"+t].update(e,r,i,o)[n]()}},b=function(t,e,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function D(t,e,n){C.call(this,t,e,n)}C.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=N(t);if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(s&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||s&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var i,o,a=this.blocks,u=this.byteCount,c=t.length,h=this.blockCount,d=0,f=this.s;d>2]|=t[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(a[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=u){for(this.start=i-u,this.block=a[h],i=0;i>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},C.prototype.encodeString=function(t){var e,r=N(t);if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(s&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||s&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}var i=0,o=t.length;if(e)i=o;else for(var a=0;a=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(t),i},C.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e>4&15]+u[15&t]+u[t>>12&15]+u[t>>8&15]+u[t>>20&15]+u[t>>16&15]+u[t>>28&15]+u[t>>24&15];a%e==0&&(O(n),o=0)}return i&&(t=n[o],s+=u[t>>4&15]+u[15&t],i>1&&(s+=u[t>>12&15]+u[t>>8&15]),i>2&&(s+=u[t>>20&15]+u[t>>16&15])),s},C.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&O(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},D.prototype=new C,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var O=function(t){var e,n,r,i,o,a,s,u,c,l,d,f,p,y,m,g,v,w,b,M,A,N,I,E,x,k,T,L,S,j,C,D,O,z,P,_,B,R,U,Q,Y,W,F,V,H,G,q,Z,J,X,K,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(l<<1|d>>>31),n=s^(d<<1|l>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=l^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,y=t[0],m=t[1],G=t[11]<<4|t[10]>>>28,q=t[10]<<4|t[11]>>>28,L=t[20]<<3|t[21]>>>29,S=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,W=t[40]<<18|t[41]>>>14,F=t[41]<<18|t[40]>>>14,z=t[2]<<1|t[3]>>>31,P=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,Z=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,j=t[33]<<13|t[32]>>>19,C=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,_=t[14]<<6|t[15]>>>26,B=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,K=t[35]<<15|t[34]>>>17,D=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,E=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,R=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,H=t[9]<<27|t[8]>>>5,k=t[18]<<20|t[19]>>>12,T=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,Q=t[38]<<8|t[39]>>>24,Y=t[39]<<8|t[38]>>>24,N=t[48]<<14|t[49]>>>18,I=t[49]<<14|t[48]>>>18,t[0]=y^~g&w,t[1]=m^~v&b,t[10]=E^~k&L,t[11]=x^~T&S,t[20]=z^~_&R,t[21]=P^~B&U,t[30]=V^~G&Z,t[31]=H^~q&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=g^~w&M,t[3]=v^~b&A,t[12]=k^~L&j,t[13]=T^~S&C,t[22]=_^~R&Q,t[23]=B^~U&Y,t[32]=G^~Z&X,t[33]=q^~J&K,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=w^~M&N,t[5]=b^~A&I,t[14]=L^~j&D,t[15]=S^~C&O,t[24]=R^~Q&W,t[25]=U^~Y&F,t[34]=Z^~X&$,t[35]=J^~K&tt,t[44]=ot^~st&ct,t[45]=at^~ut<,t[6]=M^~N&y,t[7]=A^~I&m,t[16]=j^~D&E,t[17]=C^~O&x,t[26]=Q^~W&z,t[27]=Y^~F&P,t[36]=X^~$&V,t[37]=K^~tt&H,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=N^~y&g,t[9]=I^~m&v,t[18]=D^~E&k,t[19]=O^~x&T,t[28]=W^~z&_,t[29]=F^~P&B,t[38]=$^~V&G,t[39]=tt^~H&q,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=h[r],t[1]^=h[r+1]};if(a)e.exports=I;else for(x=0;xvt[n])&&console.log.apply(console,e)}},{key:"debug",value:function(){for(var e=arguments.length,n=new Array(e),r=0;r>4],n+=At[15&e[o]];i.push(t+"=Uint8Array(0x"+n+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push("code=".concat(n)),i.push("version=".concat(this.version));var o=e,a="";switch(n){case pt.NUMERIC_FAULT:a="NUMERIC_FAULT";var s=e;switch(s){case"overflow":case"underflow":case"division-by-zero":a+="-"+s;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result"}break;case pt.CALL_EXCEPTION:case pt.INSUFFICIENT_FUNDS:case pt.MISSING_NEW:case pt.NONCE_EXPIRED:case pt.REPLACEMENT_UNDERPRICED:case pt.TRANSACTION_REPLACED:case pt.UNPREDICTABLE_GAS_LIMIT:a=n}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),i.length&&(e+=" ("+i.join(", ")+")");var u=new Error(e);return u.reason=o,u.code=n,Object.keys(r).forEach((function(t){u[t]=r[t]})),u}},{key:"throwError",value:function(t,e,n){throw this.makeError(t,e,n)}},{key:"throwArgumentError",value:function(e,n,r){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:n,value:r})}},{key:"assert",value:function(t,e,n,r){t||this.throwError(e,n,r)}},{key:"assertArgument",value:function(t,e,n,r){t||this.throwArgumentError(e,n,r)}},{key:"checkNormalize",value:function(e){Mt&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Mt})}},{key:"checkSafeUint53",value:function(e,n){"number"==typeof e&&(null==n&&(n="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(n,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(n,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}},{key:"checkArgumentCount",value:function(e,n,r){r=r?": "+r:"",en&&this.throwError("too many arguments"+r,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:n})}},{key:"checkNew",value:function(e,n){(e===Object||null==e)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:n.name})}},{key:"checkAbstract",value:function(e,n){e===n?this.throwError("cannot instantiate abstract class "+JSON.stringify(n.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||null==e)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:n.name})}}],[{key:"globalLogger",value:function(){return bt||(bt=new t("logger/5.7.0")),bt}},{key:"setCensorship",value:function(e,n){if(!e&&n&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),mt){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}gt=!!e,mt=!!n}},{key:"setLogLevel",value:function(e){var n=vt[e.toLowerCase()];null!=n?wt=n:t.globalLogger().warn("invalid log level - "+e)}},{key:"from",value:function(e){return new t(e)}}])}();Nt.errors=pt,Nt.levels=ft;var It=new Nt("bytes/5.7.0");function Et(t){return!!t.toHexString}function xt(t){return t.slice||(t.slice=function(){var e=Array.prototype.slice.call(arguments);return xt(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function kt(t){return"number"==typeof t&&t==t&&t%1==0}function Tt(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t||!kt(t.length)||t.length<0)return!1;for(var e=0;e=256)return!1}return!0}function Lt(t,e){if(e||(e={}),"number"==typeof t){It.checkSafeUint53(t,"invalid arrayify value");for(var n=[];t;)n.unshift(255&t),t=parseInt(String(t/256));return 0===n.length&&n.push(0),xt(new Uint8Array(n))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Et(t)&&(t=t.toHexString()),St(t)){var r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":It.throwArgumentError("hex data is odd-length","value",t));for(var i=[],o=0;o>4]+jt[15&o]}return r}return It.throwArgumentError("invalid hexlify value","value",t)}function Dt(t,e,n){return"string"!=typeof t?t=Ct(t):(!St(t)||t.length%2)&&It.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=n?"0x"+t.substring(e,2+2*n):"0x"+t.substring(e)}function Ot(t,e){for("string"!=typeof t?t=Ct(t):St(t)||It.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&It.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function zt(t){var e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(function(t){return St(t)&&!(t.length%2)||Tt(t)}(t)){var n=Lt(t);64===n.length?(e.v=27+(n[32]>>7),n[32]&=127,e.r=Ct(n.slice(0,32)),e.s=Ct(n.slice(32,64))):65===n.length?(e.r=Ct(n.slice(0,32)),e.s=Ct(n.slice(32,64)),e.v=n[64]):It.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:It.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(n[32]|=128),e._vs=Ct(n.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){var r=function(t,e){(t=Lt(t)).length>e&&It.throwArgumentError("value out of range","value",arguments[0]);var n=new Uint8Array(e);return n.set(t,e-t.length),xt(n)}(Lt(e._vs),32);e._vs=Ct(r);var i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&It.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;var o=Ct(r);null==e.s?e.s=o:e.s!==o&&It.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?It.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{var a=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==a&&It.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&St(e.r)?e.r=Ot(e.r,32):It.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&St(e.s)?e.s=Ot(e.s,32):It.throwArgumentError("signature missing or invalid s","signature",t);var s=Lt(e.s);s[0]>=128&&It.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(s[0]|=128);var u=Ct(s);e._vs&&(St(e._vs)||It.throwArgumentError("signature invalid _vs","signature",t),e._vs=Ot(e._vs,32)),null==e._vs?e._vs=u:e._vs!==u&&It.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Pt(t){return"0x"+yt.keccak_256(Lt(t))}var _t={exports:{}},Bt=function(t){var e=t.default;if("function"==typeof e){var n=function(){return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}(Object.freeze({__proto__:null,default:{}}));!function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"==N(t)?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o=("undefined"==typeof window?"undefined":N(window))<"u"&&N(window.Buffer)<"u"?window.Buffer:Bt.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==N(t))return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},("undefined"==typeof Symbol?"undefined":N(Symbol))<"u"&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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 p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}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 r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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 8191&e||(n+=13,e>>>=13),127&e||(n+=7,e>>>=7),15&e||(n+=4,e>>>=4),3&e||(n+=2,e>>>=2),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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&a}for(;i>26,this.words[i+r]=67108863&a;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):this.negative&t.negative?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;!(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;!(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e,r=this,o=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var a=new i(1),s=new i(0),u=o.clone();r.cmpn(1)>0&&o.cmpn(1)>0;){for(var c=0,l=1;!(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;!(o.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(o.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);r.cmp(o)>=0?(r.isub(o),a.isub(s)):(o.isub(r),s.isub(a))}return(e=0===r.cmpn(1)?a:s).cmpn(0)<0&&e.iadd(t),e},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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 E(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function x(t){E.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new I}return v[t]=e,e},E.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.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)},E.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},E.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)},E.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new x(t)},r(x,E),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,ht)}(_t);var Rt=_t.exports,Ut="bignumber/5.7.0",Qt=Rt.BN,Yt=new Nt(Ut),Wt={},Ft=9007199254740991,Vt=!1,Ht=function(){function t(e,n){v(this,t),e!==Wt&&Yt.throwError("cannot call constructor directly; use BigNumber.from",Nt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=n,this._isBigNumber=!0,Object.freeze(this)}return b(t,[{key:"fromTwos",value:function(t){return qt(Zt(this).fromTwos(t))}},{key:"toTwos",value:function(t){return qt(Zt(this).toTwos(t))}},{key:"abs",value:function(){return"-"===this._hex[0]?t.from(this._hex.substring(1)):this}},{key:"add",value:function(t){return qt(Zt(this).add(Zt(t)))}},{key:"sub",value:function(t){return qt(Zt(this).sub(Zt(t)))}},{key:"div",value:function(e){return t.from(e).isZero()&&Jt("division-by-zero","div"),qt(Zt(this).div(Zt(e)))}},{key:"mul",value:function(t){return qt(Zt(this).mul(Zt(t)))}},{key:"mod",value:function(t){var e=Zt(t);return e.isNeg()&&Jt("division-by-zero","mod"),qt(Zt(this).umod(e))}},{key:"pow",value:function(t){var e=Zt(t);return e.isNeg()&&Jt("negative-power","pow"),qt(Zt(this).pow(e))}},{key:"and",value:function(t){var e=Zt(t);return(this.isNegative()||e.isNeg())&&Jt("unbound-bitwise-result","and"),qt(Zt(this).and(e))}},{key:"or",value:function(t){var e=Zt(t);return(this.isNegative()||e.isNeg())&&Jt("unbound-bitwise-result","or"),qt(Zt(this).or(e))}},{key:"xor",value:function(t){var e=Zt(t);return(this.isNegative()||e.isNeg())&&Jt("unbound-bitwise-result","xor"),qt(Zt(this).xor(e))}},{key:"mask",value:function(t){return(this.isNegative()||t<0)&&Jt("negative-width","mask"),qt(Zt(this).maskn(t))}},{key:"shl",value:function(t){return(this.isNegative()||t<0)&&Jt("negative-width","shl"),qt(Zt(this).shln(t))}},{key:"shr",value:function(t){return(this.isNegative()||t<0)&&Jt("negative-width","shr"),qt(Zt(this).shrn(t))}},{key:"eq",value:function(t){return Zt(this).eq(Zt(t))}},{key:"lt",value:function(t){return Zt(this).lt(Zt(t))}},{key:"lte",value:function(t){return Zt(this).lte(Zt(t))}},{key:"gt",value:function(t){return Zt(this).gt(Zt(t))}},{key:"gte",value:function(t){return Zt(this).gte(Zt(t))}},{key:"isNegative",value:function(){return"-"===this._hex[0]}},{key:"isZero",value:function(){return Zt(this).isZero()}},{key:"toNumber",value:function(){try{return Zt(this).toNumber()}catch(t){Jt("overflow","toNumber",this.toString())}return null}},{key:"toBigInt",value:function(){try{return BigInt(this.toString())}catch(t){}return Yt.throwError("this platform does not support BigInt",Nt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}},{key:"toString",value:function(){return arguments.length>0&&(10===arguments[0]?Vt||(Vt=!0,Yt.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Yt.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Nt.errors.UNEXPECTED_ARGUMENT,{}):Yt.throwError("BigNumber.toString does not accept parameters",Nt.errors.UNEXPECTED_ARGUMENT,{})),Zt(this).toString(10)}},{key:"toHexString",value:function(){return this._hex}},{key:"toJSON",value:function(t){return{type:"BigNumber",hex:this.toHexString()}}}],[{key:"from",value:function(e){if(e instanceof t)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new t(Wt,Gt(e)):e.match(/^-?[0-9]+$/)?new t(Wt,Gt(new Qt(e))):Yt.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Jt("underflow","BigNumber.from",e),(e>=Ft||e<=-Ft)&&Jt("overflow","BigNumber.from",e),t.from(String(e));var n=e;if("bigint"==typeof n)return t.from(n.toString());if(Tt(n))return t.from(Ct(n));if(n)if(n.toHexString){var r=n.toHexString();if("string"==typeof r)return t.from(r)}else{var i=n._hex;if(null==i&&"BigNumber"===n.type&&(i=n.hex),"string"==typeof i&&(St(i)||"-"===i[0]&&St(i.substring(1))))return t.from(i)}return Yt.throwArgumentError("invalid BigNumber value","value",e)}},{key:"isBigNumber",value:function(t){return!(!t||!t._isBigNumber)}}])}();function Gt(t){if("string"!=typeof t)return Gt(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Yt.throwArgumentError("invalid hex","value",t),"0x00"===(t=Gt(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function qt(t){return Ht.from(Gt(t))}function Zt(t){var e=Ht.from(t).toHexString();return"-"===e[0]?new Qt("-"+e.substring(3),16):new Qt(e.substring(2),16)}function Jt(t,e,n){var r={fault:t,operation:e};return null!=n&&(r.value=n),Yt.throwError(t,Nt.errors.NUMERIC_FAULT,r)}var Xt=new Nt(Ut),Kt={},$t=Ht.from(0),te=Ht.from(-1);function ee(t,e,n,r){var i={fault:e,operation:n};return void 0!==r&&(i.value=r),Xt.throwError(t,Nt.errors.NUMERIC_FAULT,i)}for(var ne="0";ne.length<256;)ne+=ne;function re(t){if("number"!=typeof t)try{t=Ht.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+ne.substring(0,t):Xt.throwArgumentError("invalid decimal size","decimals",t)}function ie(t,e){null==e&&(e=0);var n=re(e),r=(t=Ht.from(t)).lt($t);r&&(t=t.mul(te));for(var i=t.mod(n).toString();i.length2&&Xt.throwArgumentError("too many decimal points","value",t);var o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>n.length-1&&ee("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length80&&Xt.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new t(Kt,n,r,i)}}])}(),ce=function(){function t(e,n,r,i){v(this,t),e!==Kt&&Xt.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Nt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=n,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}return b(t,[{key:"_checkFormat",value:function(t){this.format.name!==t.format.name&&Xt.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}},{key:"addUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.add(r),this.format.decimals,this.format)}},{key:"subUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.sub(r),this.format.decimals,this.format)}},{key:"mulUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}},{key:"divUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}},{key:"floor",value:function(){var e=this.toString().split(".");1===e.length&&e.push("0");var n=t.from(e[0],this.format),r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(n=n.subUnsafe(le.toFormat(n.format))),n}},{key:"ceiling",value:function(){var e=this.toString().split(".");1===e.length&&e.push("0");var n=t.from(e[0],this.format),r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(n=n.addUnsafe(le.toFormat(n.format))),n}},{key:"round",value:function(e){null==e&&(e=0);var n=this.toString().split(".");if(1===n.length&&n.push("0"),(e<0||e>80||e%1)&&Xt.throwArgumentError("invalid decimal count","decimals",e),n[1].length<=e)return this;var r=t.from("1"+ne.substring(0,e),this.format),i=he.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(i).floor().divUnsafe(r)}},{key:"isZero",value:function(){return"0.0"===this._value||"0"===this._value}},{key:"isNegative",value:function(){return"-"===this._value[0]}},{key:"toString",value:function(){return this._value}},{key:"toHexString",value:function(t){return null==t?this._hex:(t%8&&Xt.throwArgumentError("invalid byte width","width",t),Ot(Ht.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8))}},{key:"toUnsafeFloat",value:function(){return parseFloat(this.toString())}},{key:"toFormat",value:function(e){return t.fromString(this._value,e)}}],[{key:"fromValue",value:function(e,n,r){return null==r&&null!=n&&!function(t){return null!=t&&(Ht.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||St(t)||"bigint"==typeof t||Tt(t))}(n)&&(r=n,n=null),null==n&&(n=0),null==r&&(r="fixed"),t.fromString(ie(e,n),ue.from(r))}},{key:"fromString",value:function(e,n){null==n&&(n="fixed");var r=ue.from(n),i=oe(e,r.decimals);!r.signed&&i.lt($t)&&ee("unsigned value cannot be negative","overflow","value",e);var o=null;o=r.signed?i.toTwos(r.width).toHexString():Ot(o=i.toHexString(),r.width/8);var a=ie(i,r.decimals);return new t(Kt,o,a,r)}},{key:"fromBytes",value:function(e,n){null==n&&(n="fixed");var r=ue.from(n);if(Lt(e).length>r.width/8)throw new Error("overflow");var i=Ht.from(e);r.signed&&(i=i.fromTwos(r.width));var o=i.toTwos((r.signed?0:1)+r.width).toHexString(),a=ie(i,r.decimals);return new t(Kt,o,a,r)}},{key:"from",value:function(e,n){if("string"==typeof e)return t.fromString(e,n);if(Tt(e))return t.fromBytes(e,n);try{return t.fromValue(e,0,n)}catch(t){if(t.code!==Nt.errors.INVALID_ARGUMENT)throw t}return Xt.throwArgumentError("invalid FixedNumber value","value",e)}},{key:"isFixedNumber",value:function(t){return!(!t||!t._isFixedNumber)}}])}(),le=ce.from(1),he=ce.from("0.5"),de=new Nt("strings/5.7.0");function fe(t,e,n,r,i){if(t===se.BAD_PREFIX||t===se.UNEXPECTED_CONTINUE){for(var o=0,a=e+1;a>6==2;a++)o++;return o}return t===se.OVERRUN?n.length-e-1:0}function pe(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ae.current;e!=ae.current&&(de.checkNormalize(),t=t.normalize(e));for(var n=[],r=0;r>6|192),n.push(63&i|128);else if(55296==(64512&i)){r++;var o=t.charCodeAt(r);if(r>=t.length||56320!=(64512&o))throw new Error("invalid utf-8 string");var a=65536+((1023&i)<<10)+(1023&o);n.push(a>>18|240),n.push(a>>12&63|128),n.push(a>>6&63|128),n.push(63&a|128)}else n.push(i>>12|224),n.push(i>>6&63|128),n.push(63&i|128)}return Lt(n)}function ye(t,e){e||(e=function(t){return[parseInt(t,16)]});var n=0,r={};return t.split(",").forEach((function(t){var i=t.split(":");n+=parseInt(i[0],16),r[n]=e(i[1])})),r}function me(t){var e=0;return t.split(",").map((function(t){var n=t.split("-");return 1===n.length?n[1]="0":""===n[1]&&(n[1]="1"),{l:e+parseInt(n[0],16),h:e=parseInt(n[1],16)}}))}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(ae||(ae={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(se||(se={})),Object.freeze({error:function(t,e,n,r,i){return de.throwArgumentError("invalid codepoint at offset ".concat(e,"; ").concat(t),"bytes",n)},ignore:fe,replace:function(t,e,n,r,i){return t===se.OVERLONG?(r.push(i),0):(r.push(65533),fe(t,e,n))}}),me("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((function(t){return parseInt(t,16)})),ye("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),ye("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),ye("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");for(var e=[],n=0;n0&&Array.isArray(e)?t(e,i-1):n.push(e)}))}(t,e),n}function we(t){return 1&t?~t>>1:t>>1}function be(t,e){for(var n=Array(t),r=0,i=-1;r>--c&1}for(var d=Math.pow(2,31),f=d>>>1,p=f>>1,y=d-1,m=0,g=0;g<31;g++)m=m<<1|h();for(var v=[],w=0,b=d;;){for(var M=Math.floor(((m-w+1)*i-1)/b),A=0,N=r;N-A>1;){var I=A+N>>>1;M>>1|h(),E=E<<1^f,x=(x^f)<<1|f|1;w=E,b=1+x-E}var k=r-4;return v.map((function(e){switch(e-k){case 3:return k+65792+(t[u++]<<16|t[u++]<<8|t[u++]);case 2:return k+256+(t[u++]<<8|t[u++]);case 1:return k+t[u++];default:return e-1}}))}(t))}(function(t){t=atob(t);for(var e=[],n=0;n>=1),check:2==o}}()}(xe),new Nt(ge),new Uint8Array(32).fill(0),new Nt("rlp/5.7.0");var Te=new Nt("address/5.7.0");function Le(t){St(t,20)||Te.throwArgumentError("invalid address","address",t);for(var e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40),r=0;r<40;r++)n[r]=e[r].charCodeAt(0);for(var i=Lt(Pt(n)),o=0;o<40;o+=2)i[o>>1]>>4>=8&&(e[o]=e[o].toUpperCase()),(15&i[o>>1])>=8&&(e[o+1]=e[o+1].toUpperCase());return"0x"+e.join("")}for(var Se={},je=0;je<10;je++)Se[String(je)]=String(je);for(var Ce=0;Ce<26;Ce++)Se[String.fromCharCode(65+Ce)]=String(10+Ce);var De=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Oe(t,e,n){Object.defineProperty(t,e,{enumerable:!0,value:n,writable:!1})}new Nt("properties/5.7.0"),new Nt(ge),new Uint8Array(32).fill(0),Ht.from(-1);var ze=Ht.from(0),Pe=Ht.from(1);Ht.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Ot(Pe.toHexString(),32),Ot(ze.toHexString(),32);var _e={},Be={},Re=Ue;function Ue(t,e){if(!t)throw new Error(e||"Assertion failed")}Ue.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var Qe={exports:{}};"function"==typeof Object.create?Qe.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Qe.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}};var Ye=Re,We=Qe.exports;function Fe(t,e){return!(55296!=(64512&t.charCodeAt(e))||e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function Ve(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function He(t){return 1===t.length?"0"+t:t}function Ge(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}Be.inherits=We,Be.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,n[r++]=63&o|128):Fe(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i>>0}return o},Be.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},Be.rotr32=function(t,e){return t>>>e|t<<32-e},Be.rotl32=function(t,e){return t<>>32-e},Be.sum32=function(t,e){return t+e>>>0},Be.sum32_3=function(t,e,n){return t+e+n>>>0},Be.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},Be.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},Be.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o>>0,t[e+1]=o},Be.sum64_hi=function(t,e,n,r){return(e+r>>>0>>0},Be.sum64_lo=function(t,e,n,r){return e+r>>>0},Be.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)>>0)>>0)>>0},Be.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},Be.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)>>0)>>0)>>0)>>0},Be.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},Be.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},Be.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},Be.shr64_hi=function(t,e,n){return t>>>n},Be.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var qe={},Ze=Be,Je=Re;function Xe(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}qe.BlockHash=Xe,Xe.prototype.update=function(t,e){if(t=Ze.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=Ze.join32(t,0,t.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},$e.g1_256=function(t){return tn(t,17)^tn(t,19)^t>>>10};var on=Be,an=qe,sn=$e,un=on.rotl32,cn=on.sum32,ln=on.sum32_5,hn=sn.ft_1,dn=an.BlockHash,fn=[1518500249,1859775393,2400959708,3395469782];function pn(){if(!(this instanceof pn))return new pn;dn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}on.inherits(pn,dn);var yn=pn;pn.blockSize=512,pn.outSize=160,pn.hmacStrength=80,pn.padLength=64,pn.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;rthis.blockSize&&(t=(new this.Hash).update(t).digest()),Or(t.length<=this.blockSize);for(var e=t.length;e>8,a=255&i;o?n.push(o,a):n.push(a)}return n},n.zero2=r,n.toHex=i,n.encode=function(t,e){return"hex"===e?i(t):t}})),Qr=_r((function(t,e){var n=e;n.assert=Br,n.toArray=Ur.toArray,n.zero2=Ur.zero2,n.toHex=Ur.toHex,n.encode=Ur.encode,n.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},n.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=1&u?3!=(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u:0,n[0].push(a),s=1&c?3!=(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c:0,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},n.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new Rt(t,"hex","le")}})),Yr=Qr.getNAF,Wr=Qr.getJSF,Fr=Qr.assert;function Vr(t,e){this.type=t,this.p=new Rt(e.p,16),this.red=e.prime?Rt.red(e.prime):Rt.mont(this.p),this.zero=new Rt(0).toRed(this.red),this.one=new Rt(1).toRed(this.red),this.two=new Rt(2).toRed(this.red),this.n=e.n&&new Rt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hr=Vr;function Gr(t,e){this.curve=t,this.type=e,this.precomputed=null}Vr.prototype.point=function(){throw new Error("Not implemented")},Vr.prototype.validate=function(){throw new Error("Not implemented")},Vr.prototype._fixedNafMul=function(t,e){Fr(t.precomputed);var n=t._getDoubles(),r=Yr(e,1,this._bitLength),i=(1<=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];Fr(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},Vr.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var y=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(y[1]=e[f].add(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].add(e[p].neg())):(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=Wr(n[f],n[p]);for(h=Math.max(g[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a=0;o--){for(var A=0;o>=0;){var N=!0;for(a=0;a=0&&A++,b=b.dblp(A),o<0)break;for(a=0;a0?s=c[a][I-1>>1]:I<0&&(s=c[a][-I-1>>1].neg()),b="affine"===s.type?b.mixedAdd(s):b.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},Gr.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},Jr.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},Jr.prototype.pointFromX=function(t,e){(t=new Rt(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},Jr.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Jr.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},Kr.prototype.isInfinity=function(){return this.inf},Kr.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},Kr.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Kr.prototype.getX=function(){return this.x.fromRed()},Kr.prototype.getY=function(){return this.y.fromRed()},Kr.prototype.mul=function(t){return t=new Rt(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Kr.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},Kr.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},Kr.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Kr.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},Kr.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},qr($r,Hr.BasePoint),Jr.prototype.jpoint=function(t,e,n){return new $r(this,t,e,n)},$r.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},$r.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$r.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},$r.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},$r.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},$r.prototype.inspect=function(){return this.isInfinity()?"":""},$r.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var ti=_r((function(t,e){var n=e;n.base=Hr,n.short=Xr,n.mont=null,n.edwards=null})),ei=_r((function(t,e){var n,r=e,i=Qr.assert;function o(t){"short"===t.type?this.curve=new ti.short(t):"edwards"===t.type?this.curve=new ti.edwards(t):this.curve=new ti.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new o(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:_e.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:_e.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:_e.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:_e.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:_e.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_e.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_e.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(t){n=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:_e.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function ni(t){if(!(this instanceof ni))return new ni(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Ur.toArray(t.entropy,t.entropyEnc||"hex"),n=Ur.toArray(t.nonce,t.nonceEnc||"hex"),r=Ur.toArray(t.pers,t.persEnc||"hex");Br(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var ri=ni;ni.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},ni.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=Ur.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var si=Qr.assert;function ui(t,e){if(t instanceof ui)return t;this._importDER(t,e)||(si(t.r&&t.s,"Signature without r or s"),this.r=new Rt(t.r,16),this.s=new Rt(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var ci=ui;function li(){this.place=0}function hi(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o>>=0;return!(i<=127)&&(e.place=a,i)}function di(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}ui.prototype._importDER=function(t,e){t=Qr.toArray(t,e);var n=new li;if(48!==t[n.place++])return!1;var r=hi(t,n);if(!1===r||r+n.place!==t.length||2!==t[n.place++])return!1;var i=hi(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=hi(t,n);if(!1===a||t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new Rt(o),this.s=new Rt(s),this.recoveryParam=null,!0},ui.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=di(e),n=di(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];fi(r,e.length),(r=r.concat(e)).push(2),fi(r,n.length);var i=r.concat(n),o=[48];return fi(o,i.length),o=o.concat(i),Qr.encode(o,t)};var pi=function(){throw new Error("unsupported")},yi=Qr.assert;function mi(t){if(!(this instanceof mi))return new mi(t);"string"==typeof t&&(yi(Object.prototype.hasOwnProperty.call(ei,t),"Unknown curve "+t),t=ei[t]),t instanceof ei.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var gi=mi;mi.prototype.keyPair=function(t){return new ai(this,t)},mi.prototype.keyFromPrivate=function(t,e){return ai.fromPrivate(this,t,e)},mi.prototype.keyFromPublic=function(t,e){return ai.fromPublic(this,t,e)},mi.prototype.genKeyPair=function(t){t||(t={});for(var e=new ri({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||pi(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new Rt(2));;){var i=new Rt(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},mi.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},mi.prototype.sign=function(t,e,n,r){"object"==N(n)&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new Rt(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new ri({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new Rt(1)),c=0;;c++){var l=r.k?r.k(c):new Rt(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new ci({r:f,s:p,recoveryParam:y})}}}}}},mi.prototype.verify=function(t,e,n,r){t=this._truncateToN(new Rt(t,16)),n=this.keyFromPublic(n,r);var i=(e=new ci(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},mi.prototype.recoverPubKey=function(t,e,n,r){yi((3&n)===n,"The recovery param is more than two bits"),e=new ci(e,r);var i=this.n,o=new Rt(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},mi.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new ci(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var vi=_r((function(t,e){var n=e;n.version="6.5.4",n.utils=Qr,n.rand=function(){throw new Error("unsupported")},n.curve=ti,n.curves=ei,n.ec=gi,n.eddsa=null})).ec,wi=new Nt("signing-key/5.7.0"),bi=null;function Mi(){return bi||(bi=new vi("secp256k1")),bi}var Ai,Ni=b((function t(e){v(this,t),Oe(this,"curve","secp256k1"),Oe(this,"privateKey",Ct(e)),32!==function(t){if("string"!=typeof t)t=Ct(t);else if(!St(t)||t.length%2)return null;return(t.length-2)/2}(this.privateKey)&&wi.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");var n=Mi().keyFromPrivate(Lt(this.privateKey));Oe(this,"publicKey","0x"+n.getPublic(!1,"hex")),Oe(this,"compressedPublicKey","0x"+n.getPublic(!0,"hex")),Oe(this,"_isSigningKey",!0)}),[{key:"_addPoint",value:function(t){var e=Mi().keyFromPublic(Lt(this.publicKey)),n=Mi().keyFromPublic(Lt(t));return"0x"+e.pub.add(n.pub).encodeCompressed("hex")}},{key:"signDigest",value:function(t){var e=Mi().keyFromPrivate(Lt(this.privateKey)),n=Lt(t);32!==n.length&&wi.throwArgumentError("bad digest length","digest",t);var r=e.sign(n,{canonical:!0});return zt({recoveryParam:r.recoveryParam,r:Ot("0x"+r.r.toString(16),32),s:Ot("0x"+r.s.toString(16),32)})}},{key:"computeSharedSecret",value:function(t){var e=Mi().keyFromPrivate(Lt(this.privateKey)),n=Mi().keyFromPublic(Lt(Ii(t)));return Ot("0x"+e.derive(n.getPublic()).toString(16),32)}}],[{key:"isSigningKey",value:function(t){return!(!t||!t._isSigningKey)}}]);function Ii(t,e){var n=Lt(t);if(32===n.length){var r=new Ni(n);return e?"0x"+Mi().keyFromPrivate(n).getPublic(!0,"hex"):r.publicKey}return 33===n.length?e?Ct(n):"0x"+Mi().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?e?"0x"+Mi().keyFromPublic(n).getPublic(!0,"hex"):Ct(n):wi.throwArgumentError("invalid public or private key","key","[REDACTED]")}function Ei(t,e,n,r,i,o){return L(this,null,A().mark((function a(){return A().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:a.t0=n.t,a.next="eip191"===a.t0?3:"eip1271"===a.t0?4:7;break;case 3:return a.abrupt("return",xi(t,e,n.s));case 4:return a.next=6,ki(t,e,n.s,r,i,o);case 6:return a.abrupt("return",a.sent);case 7:throw new Error("verifySignature failed: Attempted to verify CacaoSignature with unknown type: ".concat(n.t));case 8:case"end":return a.stop()}}),a)})))}function xi(t,e,n){return function(t,e){return function(t){return function(t){var e=null;if("string"!=typeof t&&Te.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Le(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Te.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){for(var e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((function(t){return Se[t]})).join("");e.length>=De;){var n=e.substring(0,De);e=parseInt(n,10)%97+e.substring(n.length)}for(var r=String(98-parseInt(e,10)%97);r.length<2;)r="0"+r;return r}(t)&&Te.throwArgumentError("bad icap checksum","address",t),e=function(t){return new Qt(t,36).toString(16)}(t.substring(4));e.length<40;)e="0"+e;e=Le("0x"+e)}else Te.throwArgumentError("invalid address","address",t);return e}(Dt(Pt(Dt(Ii(t),1)),12))}(function(t,e){var n=zt(e),r={r:Lt(n.r),s:Lt(n.s)};return"0x"+Mi().recoverPubKey(Lt(t),r,n.recoveryParam).encode("hex",!1)}(Lt(t),e))}(ke(e),n).toLowerCase()===t.toLowerCase()}function ki(t,e,n,r,i,o){return L(this,null,A().mark((function a(){var s,u,c,l,h,d,f;return A().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,s="0x1626ba7e",u=n.substring(2),c=ke(e).substring(2),l=s+c+"00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041"+u,a.next=9,fetch("".concat(o||"https://rpc.walletconnect.com/v1","/?chainId=").concat(r,"&projectId=").concat(i),{method:"POST",body:JSON.stringify({id:Date.now()+Math.floor(1e3*Math.random()),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:l},"latest"]})});case 9:return h=a.sent,a.next=12,h.json();case 12:return d=a.sent,f=d.result,a.abrupt("return",!!f&&f.slice(0,s.length).toLowerCase()===s.toLowerCase());case 17:return a.prev=17,a.t0=a.catch(0),a.abrupt("return",(console.error("isValidEip1271Signature: ",a.t0),!1));case 20:case"end":return a.stop()}}),a,null,[[0,17]])})))}new Nt("transactions/5.7.0"),function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(Ai||(Ai={}));var Ti=Object.defineProperty,Li=Object.defineProperties,Si=Object.getOwnPropertyDescriptors,ji=Object.getOwnPropertySymbols,Ci=Object.prototype.hasOwnProperty,Di=Object.prototype.propertyIsEnumerable,Oi=function(t,e,n){return e in t?Ti(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},zi=function(t){return null==t?void 0:t.split(":")},Pi=function(t){var e=t&&zi(t);if(e)return t.includes("did:pkh:")?e[3]:e[1]},_i=function(t){var e=t&&zi(t);if(e)return e[2]+":"+e[3]},Bi=function(t){var e=t&&zi(t);if(e)return e.pop()};function Ri(t){return L(this,null,A().mark((function e(){var n,r,i,o,a,s;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.cacao,r=t.projectId,i=n.s,o=n.p,a=Ui(o,o.iss),s=Bi(o.iss),e.next=3,Ei(s,a,i,Pi(o.iss),r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))}var Ui=function(t,e){var n="".concat(t.domain," wants you to sign in with your Ethereum account:"),r=Bi(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");var i=t.statement||void 0,o="URI: ".concat(t.aud||t.uri),a="Version: ".concat(t.version),s="Chain ID: ".concat(Pi(e)),u="Nonce: ".concat(t.nonce),c="Issued At: ".concat(t.iat),l=t.resources?"Resources:".concat(t.resources.map((function(t){return"\n- ".concat(t)})).join("")):void 0,h=Zi(t.resources);return h&&(i=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0;Qi(e);var n="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(n))return t;var r=[],i=0;Object.keys(e.att).forEach((function(t){var n=Object.keys(e.att[t]).map((function(t){return{ability:t.split("/")[0],action:t.split("/")[1]}}));n.sort((function(t,e){return t.action.localeCompare(e.action)}));var o={};n.forEach((function(t){o[t.ability]||(o[t.ability]=[]),o[t.ability].push(t.action)}));var a=Object.keys(o).map((function(e){return i++,"(".concat(i,") '").concat(e,"': '").concat(o[e].join("', '"),"' for '").concat(t,"'.")}));r.push(a.join(", ").replace(".,","."))}));var o=r.join(" "),a="".concat(n).concat(o);return"".concat(t?t+" ":"").concat(a)}(i,Fi(h))),[n,r,"",i,"",o,a,s,u,c,l].filter((function(t){return null!=t})).join("\n")};function Qi(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");var e=Object.keys(t.att);if(null==e||!e.length)throw new Error("No resources found in `att` property");e.forEach((function(e){var n=t.att[e];if(Array.isArray(n))throw new Error("Resource must be an object: ".concat(e));if("object"!=N(n))throw new Error("Resource must be an object: ".concat(e));if(!Object.keys(n).length)throw new Error("Resource object is empty: ".concat(e));Object.keys(n).forEach((function(t){var e=n[t];if(!Array.isArray(e))throw new Error("Ability limits ".concat(t," must be an array of objects, found: ").concat(e));if(!e.length)throw new Error("Value of ".concat(t," is empty array, must be an array with objects"));e.forEach((function(e){if("object"!=N(e))throw new Error("Ability limits (".concat(t,") must be an array of objects, found: ").concat(e))}))}))}))}function Yi(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(e=null==e?void 0:e.sort((function(t,e){return t.localeCompare(e)}))).map((function(e){return g({},"".concat(t,"/").concat(e),[n])}));return Object.assign.apply(Object,[{}].concat(E(r)))}function Wi(t){return Qi(t),"urn:recap:".concat(function(t){return i.from(JSON.stringify(t)).toString("base64")}(t).replace(/=/g,""))}function Fi(t){var e=function(t){return JSON.parse(i.from(t,"base64").toString("utf-8"))}(t.replace("urn:recap:",""));return Qi(e),e}function Vi(t,e,n){return Wi(function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return null==n||n.sort((function(t,e){return t.localeCompare(e)})),{att:g({},t,Yi(e,n,r))}}(t,e,n))}function Hi(t,e){return Wi(function(t,e){Qi(t),Qi(e);var n=Object.keys(t.att).concat(Object.keys(e.att)).sort((function(t,e){return t.localeCompare(e)})),r={att:{}};return n.forEach((function(n){var i,o;Object.keys((null==(i=t.att)?void 0:i[n])||{}).concat(Object.keys((null==(o=e.att)?void 0:o[n])||{})).sort((function(t,e){return t.localeCompare(e)})).forEach((function(i){var o,a;r.att[n]=function(t,e){return Li(t,Si(e))}(function(t,e){for(var n in e||(e={}))Ci.call(e,n)&&Oi(t,n,e[n]);if(ji){var r,i=I(ji(e));try{for(i.s();!(r=i.n()).done;)n=r.value,Di.call(e,n)&&Oi(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t}({},r.att[n]),g({},i,(null==(o=t.att[n])?void 0:o[i])||(null==(a=e.att[n])?void 0:a[i])))}))})),r}(Fi(t),Fi(e)))}function Gi(t){var e,n=Fi(t);Qi(n);var r=null==(e=n.att)?void 0:e.eip155;return r?Object.keys(r).map((function(t){return t.split("/")[1]})):[]}function qi(t){var e=Fi(t);Qi(e);var n=[];return Object.values(e.att).forEach((function(t){Object.values(t).forEach((function(t){var e;null!=(e=null==t?void 0:t[0])&&e.chains&&n.push(t[0].chains)}))})),E(new Set(n.flat()))}function Zi(t){if(t){var e=null==t?void 0:t[t.length-1];return function(t){return t&&t.includes("urn:recap:")}(e)?e:void 0}}var Ji="base16",Xi="base64pad",Ki="utf8",$i=1;function to(){var t=p.generateKeyPair();return{privateKey:Object(y.toString)(t.secretKey,Ji),publicKey:Object(y.toString)(t.publicKey,Ji)}}function eo(){var t=Object(d.randomBytes)(32);return Object(y.toString)(t,Ji)}function no(t,e){var n=p.sharedKey(Object(y.fromString)(t,Ji),Object(y.fromString)(e,Ji),!0),r=new h.HKDF(f.SHA256,n).expand(32);return Object(y.toString)(r,Ji)}function ro(t){var e=Object(f.hash)(Object(y.fromString)(t,Ji));return Object(y.toString)(e,Ji)}function io(t){var e=Object(f.hash)(Object(y.fromString)(t,Ki));return Object(y.toString)(e,Ji)}function oo(t){return Number(Object(y.toString)(t,"base10"))}function ao(t){var e=function(t){return Object(y.fromString)("".concat(t),"base10")}(N(t.type)<"u"?t.type:0);if(oo(e)===$i&&N(t.senderPublicKey)>"u")throw new Error("Missing sender public key for type 1 envelope");var n=N(t.senderPublicKey)<"u"?Object(y.fromString)(t.senderPublicKey,Ji):void 0,r=N(t.iv)<"u"?Object(y.fromString)(t.iv,Ji):Object(d.randomBytes)(12);return function(t){if(oo(t.type)===$i){if(N(t.senderPublicKey)>"u")throw new Error("Missing sender public key for type 1 envelope");return Object(y.toString)(Object(y.concat)([t.type,t.senderPublicKey,t.iv,t.sealed]),Xi)}return Object(y.toString)(Object(y.concat)([t.type,t.iv,t.sealed]),Xi)}({type:e,sealed:new l.ChaCha20Poly1305(Object(y.fromString)(t.symKey,Ji)).seal(r,Object(y.fromString)(t.message,Ki)),iv:r,senderPublicKey:n})}function so(t){var e=new l.ChaCha20Poly1305(Object(y.fromString)(t.symKey,Ji)),n=uo(t.encoded),r=n.sealed,i=n.iv,o=e.open(i,r);if(null===o)throw new Error("Failed to decrypt");return Object(y.toString)(o,Ki)}function uo(t){var e=Object(y.fromString)(t,Xi),n=e.slice(0,1);if(oo(n)===$i){var r=e.slice(1,33),i=e.slice(33,45);return{type:n,sealed:e.slice(45),iv:i,senderPublicKey:r}}var o=e.slice(1,13);return{type:n,sealed:e.slice(13),iv:o}}function co(t,e){var n=uo(t);return lo({type:oo(n.type),senderPublicKey:N(n.senderPublicKey)<"u"?Object(y.toString)(n.senderPublicKey,Ji):void 0,receiverPublicKey:null==e?void 0:e.receiverPublicKey})}function lo(t){var e=(null==t?void 0:t.type)||0;if(e===$i){if(N(null==t?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(N(null==t?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:null==t?void 0:t.senderPublicKey,receiverPublicKey:null==t?void 0:t.receiverPublicKey}}function ho(t){return t.type===$i&&"string"==typeof t.senderPublicKey&&"string"==typeof t.receiverPublicKey}function fo(t){return(null==t?void 0:t.relay)||{protocol:"irn"}}function po(t){var e=m.RELAY_JSONRPC[t];if(N(e)>"u")throw new Error("Relay Protocol not supported: ".concat(t));return e}var yo=Object.defineProperty,mo=Object.defineProperties,go=Object.getOwnPropertyDescriptors,vo=Object.getOwnPropertySymbols,wo=Object.prototype.hasOwnProperty,bo=Object.prototype.propertyIsEnumerable,Mo=function(t,e,n){return e in t?yo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},Ao=function(t,e){for(var n in e||(e={}))wo.call(e,n)&&Mo(t,n,e[n]);if(vo){var r,i=I(vo(e));try{for(i.s();!(r=i.n()).done;)n=r.value,bo.call(e,n)&&Mo(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t};function No(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",n={},r="relay"+e;return Object.keys(t).forEach((function(e){if(e.startsWith(r)){var i=e.replace(r,""),o=t[e];n[i]=o}})),n}function Io(t){var e=(t=(t=t.includes("wc://")?t.replace("wc://",""):t).includes("wc:")?t.replace("wc:",""):t).indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e),i=t.substring(e+1,n).split("@"),o=N(n)<"u"?t.substring(n):"",a=c.parse(o),s="string"==typeof a.methods?a.methods.split(","):void 0;return{protocol:r,topic:Eo(i[0]),version:parseInt(i[1],10),symKey:a.symKey,relay:No(a),methods:s,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function Eo(t){return t.startsWith("//")?t.substring(2):t}function xo(t){return"".concat(t.protocol,":").concat(t.topic,"@").concat(t.version,"?")+c.stringify(Ao(function(t,e){return mo(t,go(e))}(Ao({symKey:t.symKey},function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",n="relay",r={};return Object.keys(t).forEach((function(i){var o=n+e+i;t[i]&&(r[o]=t[i])})),r}(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function ko(t){var e=[];return t.forEach((function(t){var n=x(t.split(":"),2),r=n[0],i=n[1];e.push("".concat(r,":").concat(i))})),e}function To(t,e){for(var n=function(t){var e={};return null==t||t.forEach((function(t){var n=x(t.split(":"),2),r=n[0],i=n[1];e[r]||(e[r]={accounts:[],chains:[],events:[]}),e[r].accounts.push(t),e[r].chains.push("".concat(r,":").concat(i))})),e}(e=e.map((function(t){return t.replace("did:pkh:","")}))),r=0,i=Object.entries(n);r"u"}function Po(t,e){return!(!e||!zo(t))||"string"==typeof t&&!!t.trim().length}function _o(t,e){return!(!e||!zo(t))||"number"==typeof t&&!isNaN(t)}function Bo(t,e){var n=e.requiredNamespaces,r=Object.keys(t.namespaces),i=Object.keys(n),o=!0;return!!J(i,r)&&(r.forEach((function(e){var r=t.namespaces[e],i=r.accounts,a=r.methods,s=r.events,u=ko(i),c=n[e];J(j(e,c),u)&&J(c.methods,a)&&J(c.events,s)||(o=!1)})),o)}function Ro(t){return!(!Po(t,!1)||!t.includes(":"))&&2===t.split(":").length}function Uo(t){if(Po(t,!1))try{return N(new URL(t))<"u"}catch(t){return!1}return!1}function Qo(t){var e;return null==(e=null==t?void 0:t.proposer)?void 0:e.publicKey}function Yo(t){return null==t?void 0:t.topic}function Wo(t,e){var n=null;return Po(null==t?void 0:t.publicKey,!1)||(n=jo("MISSING_OR_INVALID","".concat(e," controller public key should be a string"))),n}function Fo(t){var e=!0;return Do(t)?t.length&&(e=t.every((function(t){return Po(t,!1)}))):e=!1,e}function Vo(t,e){var n=null;return Object.values(t).forEach((function(t){if(!n){var r=function(t,e){var n=null;return Fo(null==t?void 0:t.methods)?Fo(null==t?void 0:t.events)||(n=Co("UNSUPPORTED_EVENTS","".concat(e,", events should be an array of strings or empty array for no events"))):n=Co("UNSUPPORTED_METHODS","".concat(e,", methods should be an array of strings or empty array for no methods")),n}(t,"".concat(e,", namespace"));r&&(n=r)}})),n}function Ho(t,e,n){var r=null;if(t&&Oo(t)){var i=Vo(t,e);i&&(r=i);var o=function(t,e,n){var r=null;return Object.entries(t).forEach((function(t){var i=x(t,2),o=i[0],a=i[1];if(!r){var s=function(t,e,n){var r=null;return Do(e)&&e.length?e.forEach((function(t){r||Ro(t)||(r=Co("UNSUPPORTED_CHAINS","".concat(n,", chain ").concat(t,' should be a string and conform to "namespace:chainId" format')))})):Ro(t)||(r=Co("UNSUPPORTED_CHAINS","".concat(n,', chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }'))),r}(o,j(o,a),"".concat(e," ").concat(n));s&&(r=s)}})),r}(t,e,n);o&&(r=o)}else r=jo("MISSING_OR_INVALID","".concat(e,", ").concat(n," should be an object with data"));return r}function Go(t,e){var n=null;if(t&&Oo(t)){var r=Vo(t,e);r&&(n=r);var i=function(t,e){var n=null;return Object.values(t).forEach((function(t){if(!n){var r=function(t,e){var n=null;return Do(t)?t.forEach((function(t){n||function(t){if(Po(t,!1)&&t.includes(":")){var e=t.split(":");if(3===e.length){var n=e[0]+":"+e[1];return!!e[2]&&Ro(n)}}return!1}(t)||(n=Co("UNSUPPORTED_ACCOUNTS","".concat(e,", account ").concat(t,' should be a string and conform to "namespace:chainId:address" format')))})):n=Co("UNSUPPORTED_ACCOUNTS","".concat(e,', accounts should be an array of strings conforming to "namespace:chainId:address" format')),n}(null==t?void 0:t.accounts,"".concat(e," namespace"));r&&(n=r)}})),n}(t,e);i&&(n=i)}else n=jo("MISSING_OR_INVALID","".concat(e,", namespaces should be an object with data"));return n}function qo(t){return Po(t.protocol,!0)}function Zo(t,e){var n=!1;return e&&!t?n=!0:t&&Do(t)&&t.length&&t.forEach((function(t){n=qo(t)})),n}function Jo(t){return"number"==typeof t}function Xo(t){return N(t)<"u"&&null!==N(t)}function Ko(t){return!!(t&&"object"==N(t)&&t.code&&_o(t.code,!1)&&t.message&&Po(t.message,!1))}function $o(t){return!(zo(t)||!Po(t.method,!1))}function ta(t){return!(zo(t)||zo(t.result)&&zo(t.error)||!_o(t.id,!1)||!Po(t.jsonrpc,!1))}function ea(t){return!(zo(t)||!Po(t.name,!1))}function na(t,e){return!(!Ro(e)||!function(t){var e=[];return Object.values(t).forEach((function(t){e.push.apply(e,E(ko(t.accounts)))})),e}(t).includes(e))}function ra(t,e,n){return!!Po(n,!1)&&function(t,e){var n=[];return Object.values(t).forEach((function(t){ko(t.accounts).includes(e)&&n.push.apply(n,E(t.methods))})),n}(t,e).includes(n)}function ia(t,e,n){return!!Po(n,!1)&&function(t,e){var n=[];return Object.values(t).forEach((function(t){ko(t.accounts).includes(e)&&n.push.apply(n,E(t.events))})),n}(t,e).includes(n)}function oa(t,e,n){var r=null,i=function(t){var e={};return Object.keys(t).forEach((function(n){var r;n.includes(":")?e[n]=t[n]:null==(r=t[n].chains)||r.forEach((function(r){e[r]={methods:t[n].methods,events:t[n].events}}))})),e}(t),o=function(t){var e={};return Object.keys(t).forEach((function(n){if(n.includes(":"))e[n]=t[n];else{var r=ko(t[n].accounts);null==r||r.forEach((function(r){e[r]={accounts:t[n].accounts.filter((function(t){return t.includes("".concat(r,":"))})),methods:t[n].methods,events:t[n].events}}))}})),e}(e),a=Object.keys(i),s=Object.keys(o),u=aa(Object.keys(t)),c=aa(Object.keys(e)),l=u.filter((function(t){return!c.includes(t)}));return l.length&&(r=jo("NON_CONFORMING_NAMESPACES","".concat(n," namespaces keys don't satisfy requiredNamespaces.\n Required: ").concat(l.toString(),"\n Received: ").concat(Object.keys(e).toString()))),J(a,s)||(r=jo("NON_CONFORMING_NAMESPACES","".concat(n," namespaces chains don't satisfy required namespaces.\n Required: ").concat(a.toString(),"\n Approved: ").concat(s.toString()))),Object.keys(e).forEach((function(t){if(t.includes(":")&&!r){var i=ko(e[t].accounts);i.includes(t)||(r=jo("NON_CONFORMING_NAMESPACES","".concat(n," namespaces accounts don't satisfy namespace accounts for ").concat(t,"\n Required: ").concat(t,"\n Approved: ").concat(i.toString())))}})),a.forEach((function(t){r||(J(i[t].methods,o[t].methods)?J(i[t].events,o[t].events)||(r=jo("NON_CONFORMING_NAMESPACES","".concat(n," namespaces events don't satisfy namespace events for ").concat(t))):r=jo("NON_CONFORMING_NAMESPACES","".concat(n," namespaces methods don't satisfy namespace methods for ").concat(t)))})),r}function aa(t){return E(new Set(t.map((function(t){return t.includes(":")?t.split(":")[0]:t}))))}function sa(t,e){return _o(t,!1)&&t<=e.max&&t>=e.min}function ua(){var t=V();return new Promise((function(e){switch(t){case U:e(F()&&(null==navigator?void 0:navigator.onLine));break;case B:e(function(){return L(this,null,A().mark((function t(){var e;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(W()&&(void 0===r?"undefined":N(r))<"u"&&null!=r&&r.NetInfo)){t.next=5;break}return t.next=3,null==r?void 0:r.NetInfo.fetch();case 3:return e=t.sent,t.abrupt("return",null==e?void 0:e.isConnected);case 5:return t.abrupt("return",!0);case 6:case"end":return t.stop()}}),t)})))}());break;default:e(!0)}}))}function ca(t){switch(V()){case U:!function(t){!W()&&F()&&(window.addEventListener("online",(function(){return t(!0)})),window.addEventListener("offline",(function(){return t(!1)})))}(t);break;case B:!function(t){W()&&(void 0===r?"undefined":N(r))<"u"&&null!=r&&r.NetInfo&&(null==r||r.NetInfo.addEventListener((function(e){return t(null==e?void 0:e.isConnected)})))}(t)}}var la={},ha=b((function t(){v(this,t)}),null,[{key:"get",value:function(t){return la[t]}},{key:"set",value:function(t,e){la[t]=e}},{key:"delete",value:function(t){delete la[t]}}])}).call(this,n(33),n(26),n(116).Buffer)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(16);r.__exportStar(n(76),e),r.__exportStar(n(81),e),r.__exportStar(n(82),e),r.__exportStar(n(45),e)},function(t,e,n){n(7);var r=n(25);n.d(e,"parseConnectionError",(function(){return r.d}));var i=n(54);n.o(i,"IJsonRpcProvider")&&n.d(e,"IJsonRpcProvider",(function(){return i.IJsonRpcProvider})),n.o(i,"formatJsonRpcError")&&n.d(e,"formatJsonRpcError",(function(){return i.formatJsonRpcError})),n.o(i,"formatJsonRpcRequest")&&n.d(e,"formatJsonRpcRequest",(function(){return i.formatJsonRpcRequest})),n.o(i,"formatJsonRpcResult")&&n.d(e,"formatJsonRpcResult",(function(){return i.formatJsonRpcResult})),n.o(i,"getBigIntRpcId")&&n.d(e,"getBigIntRpcId",(function(){return i.getBigIntRpcId})),n.o(i,"isJsonRpcError")&&n.d(e,"isJsonRpcError",(function(){return i.isJsonRpcError})),n.o(i,"isJsonRpcRequest")&&n.d(e,"isJsonRpcRequest",(function(){return i.isJsonRpcRequest})),n.o(i,"isJsonRpcResponse")&&n.d(e,"isJsonRpcResponse",(function(){return i.isJsonRpcResponse})),n.o(i,"isJsonRpcResult")&&n.d(e,"isJsonRpcResult",(function(){return i.isJsonRpcResult})),n.o(i,"isLocalhostUrl")&&n.d(e,"isLocalhostUrl",(function(){return i.isLocalhostUrl})),n.o(i,"isReactNative")&&n.d(e,"isReactNative",(function(){return i.isReactNative})),n.o(i,"isWsUrl")&&n.d(e,"isWsUrl",(function(){return i.isWsUrl})),n.o(i,"payloadId")&&n.d(e,"payloadId",(function(){return i.payloadId}));var o=n(55);n.d(e,"formatJsonRpcError",(function(){return o.a})),n.d(e,"formatJsonRpcRequest",(function(){return o.b})),n.d(e,"formatJsonRpcResult",(function(){return o.c})),n.d(e,"getBigIntRpcId",(function(){return o.d})),n.d(e,"payloadId",(function(){return o.e})),n(56);var a=n(63);n.d(e,"IJsonRpcProvider",(function(){return a.a}));var s=n(57);n.d(e,"isLocalhostUrl",(function(){return s.a})),n.d(e,"isWsUrl",(function(){return s.b}));var u=n(58);n.d(e,"isJsonRpcError",(function(){return u.a})),n.d(e,"isJsonRpcRequest",(function(){return u.b})),n.d(e,"isJsonRpcResponse",(function(){return u.c})),n.d(e,"isJsonRpcResult",(function(){return u.d}))},function(t,e,n){n.d(e,"h",(function(){return r})),n.d(e,"i",(function(){return i})),n.d(e,"f",(function(){return o})),n.d(e,"g",(function(){return a})),n.d(e,"e",(function(){return s})),n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return c})),n.d(e,"d",(function(){return l})),n.d(e,"c",(function(){return h})),n.d(e,"l",(function(){return d})),n.d(e,"k",(function(){return f})),n.d(e,"m",(function(){return p})),n.d(e,"n",(function(){return y})),n.d(e,"j",(function(){return m}));var r="EdDSA",i="JWT",o=".",a="base64url",s="utf8",u="utf8",c=":",l="did",h="key",d="base58btc",f="z",p="K36",y=32,m=32},function(t,e,n){n.d(e,"a",(function(){return D})),n.d(e,"b",(function(){return O})),n.d(e,"c",(function(){return T})),n.d(e,"d",(function(){return j}));var r=n(15),i=n.n(r);n.d(e,"e",(function(){return i.a}));var o=n(8);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nthis.maxSizeInBytes)throw new Error("[LinkedList] Value too big to insert into list: ".concat(t," with size ").concat(e.size));for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}},{key:"shift",value:function(){if(this.head){var t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}}},{key:"toArray",value:function(){for(var t=[],e=this.head;null!==e;)t.push(e.value),e=e.next;return t}},{key:"length",get:function(){return this.lengthInNodes}},{key:"size",get:function(){return this.sizeInBytes}},{key:"toOrderedArray",value:function(){return Array.from(this)}},{key:Symbol.iterator,value:function(){var t=this.head;return{next:function(){if(!t)return{done:!0,value:null};var e=t.value;return t=t.next,{done:!1,value:e}}}}}]),m=l((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,t),this.level=null!=e?e:"error",this.levelValue=r.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new y(this.MAX_LOG_SIZE_IN_BYTES)}),[{key:"forwardToConsole",value:function(t,e){e===r.levels.values.error?console.error(t):e===r.levels.values.warn?console.warn(t):e===r.levels.values.debug?console.debug(t):e===r.levels.values.trace?console.trace(t):console.log(t)}},{key:"appendToLogs",value:function(t){this.logs.append(Object(o.b)({timestamp:(new Date).toISOString(),log:t}));var e="string"==typeof t?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}},{key:"getLogs",value:function(){return this.logs}},{key:"clearLogs",value:function(){this.logs=new y(this.MAX_LOG_SIZE_IN_BYTES)}},{key:"getLogArray",value:function(){return Array.from(this.logs)}},{key:"logsToBlob",value:function(t){var e=this.getLogArray();return e.push(Object(o.b)({extraMetadata:t})),new Blob(e,{type:"application/json"})}}]),g=l((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,t),this.baseChunkLogger=new m(e,n)}),[{key:"write",value:function(t){this.baseChunkLogger.appendToLogs(t)}},{key:"getLogs",value:function(){return this.baseChunkLogger.getLogs()}},{key:"clearLogs",value:function(){this.baseChunkLogger.clearLogs()}},{key:"getLogArray",value:function(){return this.baseChunkLogger.getLogArray()}},{key:"logsToBlob",value:function(t){return this.baseChunkLogger.logsToBlob(t)}},{key:"downloadLogsBlobInBrowser",value:function(t){var e=URL.createObjectURL(this.logsToBlob(t)),n=document.createElement("a");n.href=e,n.download="walletconnect-logs-".concat((new Date).toISOString(),".txt"),document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}}]),v=l((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,t),this.baseChunkLogger=new m(e,n)}),[{key:"write",value:function(t){this.baseChunkLogger.appendToLogs(t)}},{key:"getLogs",value:function(){return this.baseChunkLogger.getLogs()}},{key:"clearLogs",value:function(){this.baseChunkLogger.clearLogs()}},{key:"getLogArray",value:function(){return this.baseChunkLogger.getLogArray()}},{key:"logsToBlob",value:function(t){return this.baseChunkLogger.logsToBlob(t)}}]),w=Object.defineProperty,b=Object.defineProperties,M=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,E=function(t,e,n){return e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},x=function(t,e){for(var n in e||(e={}))N.call(e,n)&&E(t,n,e[n]);if(A){var r,i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}(t))){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw o}}}}(A(e));try{for(i.s();!(r=i.n()).done;)n=r.value,I.call(e,n)&&E(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},k=function(t,e){return b(t,M(e))};function T(t){return k(x({},t),{level:(null==t?void 0:t.level)||"info"})}function L(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;return t[e]||""}function S(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d;return t[n]=e,t}function j(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;return s(t.bindings)>"u"?L(t,e):t.bindings().context||""}function C(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,r=j(t,n);return r.trim()?"".concat(r,"/").concat(e):e}function D(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,r=C(t,e,n),i=t.child({context:r});return S(i,r,n)}function O(t){return s(t.loggerOverride)<"u"&&"string"!=typeof t.loggerOverride?{logger:t.loggerOverride,chunkLoggerController:null}:("undefined"==typeof window?"undefined":s(window))<"u"?function(t){var e,n,r=new g(null==(e=t.opts)?void 0:e.level,t.maxSizeInBytes);return{logger:i()(k(x({},t.opts),{level:"trace",browser:k(x({},null==(n=t.opts)?void 0:n.browser),{write:function(t){return r.write(t)}})})),chunkLoggerController:r}}(t):function(t){var e,n=new v(null==(e=t.opts)?void 0:e.level,t.maxSizeInBytes);return{logger:i()(k(x({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}(t)}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(109),i=n(42),o=n(110),a=n(17),s=n(20),u=n(111);e.compare=r.compare,e.concat=i.concat,e.equals=o.equals,e.fromString=a.fromString,e.toString=s.toString,e.xor=u.xor},function(t,e,n){var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}g(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&g(t,"error",e,{once:!0})}(t,i)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.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?s.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var i,o,a,s;if(c(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=l(t))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return t}function d(){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 f(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function p(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)o(u,this,e);else{var c=u.length,l=m(u,c);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):y.call(t,e)},s.prototype.listenerCount=y,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e,n){var i;return i=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e),(e="symbol"==r(i)?i:i+"")in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}n.d(e,"b",(function(){return o})),n.d(e,"d",(function(){return a})),n.d(e,"c",(function(){return s})),n.d(e,"e",(function(){return u})),n.d(e,"f",(function(){return c})),n.d(e,"a",(function(){return l}));var o="INTERNAL_ERROR",a="SERVER_ERROR",s=[-32700,-32600,-32601,-32602,-32603],u=[-32e3,-32099],c=i(i(i(i(i(i({},"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"}),o,{code:-32603,message:"Internal error"}),a,{code:-32e3,message:"Server error"}),l=a},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){if("string"!=typeof t)throw new Error("Cannot safe json parse value of type ".concat(r(t)));try{return e=t.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3'),JSON.parse(e,(function(t,e){return"string"==typeof e&&e.match(/^\d+n$/)?BigInt(e.substring(0,e.length-1)):e}))}catch(e){return t}var e}function o(t){return"string"==typeof t?t:(e=t,JSON.stringify(e,(function(t,e){return"bigint"==typeof e?e.toString()+"n":e}))||"");var e}n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o}))},function(t,e,n){(function(t){n.d(e,"a",(function(){return Tn})),n.d(e,"b",(function(){return Pe})),n.d(e,"c",(function(){return Ce})),n.d(e,"d",(function(){return we})),n.d(e,"e",(function(){return Ae})),n.d(e,"f",(function(){return mn})),n.d(e,"g",(function(){return Be}));var r=n(6),i=n.n(r),o=n(64),a=n(27),s=n(4),u=n(11),c=n(8),l=n(31),h=n(0),d=n(5),f=n(1),p=n(72),y=n(2),m=n(65),g=n(66),v=n.n(g),w=n(67),b=n.n(w);function M(t){return function(t){if(Array.isArray(t))return P(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||z(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(t,e,n){return e=I(e),function(t,e){if(e&&("object"===k(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return N(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return!!t}()?Reflect.construct(e,n||[],I(t).constructor):e.apply(t,n))}function N(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function I(t){return(I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function E(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&x(t,e)}function x(t,e){return(x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function k(t){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function T(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */T=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof m?e:m,a=Object.create(o.prototype),s=new j(r||[]);return i(a,"_invoke",{value:E(t,n,s)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",f="executing",p="completed",y={};function m(){}function g(){}function v(){}var w={};c(w,a,(function(){return this}));var b=Object.getPrototypeOf,M=b&&b(b(C([])));M&&M!==n&&r.call(M,a)&&(w=M);var A=v.prototype=m.prototype=Object.create(w);function N(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function n(i,o,a,s){var u=h(t[i],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==k(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function E(e,n,r){var i=d;return function(o,a){if(i===f)throw Error("Generator is already running");if(i===p){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var u=x(s,r);if(u){if(u===y)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=h(e,n,r);if("normal"===c.type){if(i=r.done?p:"suspendedYield",c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=p,r.method="throw",r.arg=c.arg)}}}function x(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,x(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=h(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function L(t,e,n){return(e=D(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function S(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function j(t,e){for(var n=0;n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function z(t,e){if(t){if("string"==typeof t)return P(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r>>0,a=new Uint8Array(o);t[e];){var l=n[t.charCodeAt(e)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h>>0,a[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,e++}if(" "!==t[e]){for(var f=o-i;f!==o&&0===a[f];)f++;for(var p=new Uint8Array(r+(o-f)),y=r;f!==o;)p[y++]=a[f++];return p}}}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var a=(o-i)*l+1>>>0,c=new Uint8Array(a);i!==o;){for(var h=e[i],d=0,f=a-1;(0!==h||d>>0,c[f]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=a-r;p!==a&&0===c[p];)p++;for(var y=u.repeat(n);pn;)o+=e[i&s>>(a-=n)];if(a&&(o+=e[i&s<=8&&(u-=8,s[l++]=255&c>>u)}if(u>=n||255&c<<8-u)throw new SyntaxError("Unexpected end of data");return s}(t,i,r,e)}})},$=J({prefix:"\0",name:"identity",encode:function(t){return function(t){return(new TextDecoder).decode(t)}(t)},decode:function(t){return function(t){return(new TextEncoder).encode(t)}(t)}}),tt=Object.freeze({__proto__:null,identity:$}),et=K({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),nt=Object.freeze({__proto__:null,base2:et}),rt=K({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),it=Object.freeze({__proto__:null,base8:rt}),ot=X({prefix:"9",name:"base10",alphabet:"0123456789"}),at=Object.freeze({__proto__:null,base10:ot}),st=K({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ut=K({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),ct=Object.freeze({__proto__:null,base16:st,base16upper:ut}),lt=K({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ht=K({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),dt=K({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ft=K({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pt=K({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),yt=K({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),mt=K({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gt=K({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),vt=K({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),wt=Object.freeze({__proto__:null,base32:lt,base32upper:ht,base32pad:dt,base32padupper:ft,base32hex:pt,base32hexupper:yt,base32hexpad:mt,base32hexpadupper:gt,base32z:vt}),bt=X({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Mt=X({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),At=Object.freeze({__proto__:null,base36:bt,base36upper:Mt}),Nt=X({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),It=X({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Et=Object.freeze({__proto__:null,base58btc:Nt,base58flickr:It}),xt=K({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),kt=K({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Tt=K({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Lt=K({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),St=Object.freeze({__proto__:null,base64:xt,base64pad:kt,base64url:Tt,base64urlpad:Lt}),jt=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Ct=jt.reduce((function(t,e,n){return t[n]=e,t}),[]),Dt=jt.reduce((function(t,e,n){return t[e.codePointAt(0)]=n,t}),[]),Ot=J({prefix:"🚀",name:"base256emoji",encode:function(t){return t.reduce((function(t,e){return t+Ct[e]}),"")},decode:function(t){var e,n=[],r=O(t);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Dt[i.codePointAt(0)];if(void 0===o)throw new Error("Non-base256emoji character: ".concat(i));n.push(o)}}catch(t){r.e(t)}finally{r.f()}return new Uint8Array(n)}}),zt=Object.freeze({__proto__:null,base256emoji:Ot}),Pt=Math.pow(2,31),_t=Math.pow(2,7),Bt=Math.pow(2,14),Rt=Math.pow(2,21),Ut=Math.pow(2,28),Qt=Math.pow(2,35),Yt=Math.pow(2,42),Wt=Math.pow(2,49),Ft=Math.pow(2,56),Vt=Math.pow(2,63),Ht=function t(e,n,r){n=n||[];for(var i=r=r||0;e>=Pt;)n[r++]=255&e|128,e/=128;for(;-128&e;)n[r++]=255&e|128,e>>>=7;return n[r]=0|e,t.bytes=r-i+1,n},Gt=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Ht(t,e,n),e},qt=function(t){return function(t){return t<_t?1:t0&&void 0!==arguments[0]?arguments[0]:0;return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?se(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}((t=t.substring(1)).length),n=0;n1&&void 0!==arguments[1]?arguments[1]:"utf8",n=he[e];if(!n)throw new Error('Unsupported encoding "'.concat(e,'"'));return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode("".concat(n.prefix).concat(t)):se(globalThis.Buffer.from(t,"utf-8"))}var fe="core",pe="".concat("wc","@2:").concat(fe,":"),ye={database:":memory:"},me="client_ed25519_seed",ge=f.ONE_DAY,ve=f.SIX_HOURS,we="irn",be="wss://relay.walletconnect.com",Me="wss://relay.walletconnect.org",Ae={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Ne="payload",Ie="connect",Ee="disconnect",xe="error",ke=f.ONE_SECOND,Te="subscription_created",Le="subscription_deleted",Se=(f.THIRTY_DAYS,1e3*f.FIVE_SECONDS),je=(f.THIRTY_DAYS,{wc_pairingDelete:{req:{ttl:f.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:f.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:f.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:f.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:f.ONE_DAY,prompt:!1,tag:0},res:{ttl:f.ONE_DAY,prompt:!1,tag:0}}}),Ce={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},De="history_created",Oe="history_updated",ze="history_deleted",Pe={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},_e=(f.ONE_DAY,"verify-api"),Be="https://verify.walletconnect.com",Re="https://verify.walletconnect.org",Ue=[Be,Re],Qe=C((function t(e,n){var r=this;S(this,t),this.core=e,this.logger=n,this.keychain=new Map,this.name="keychain",this.version="0.3",this.initialized=!1,this.storagePrefix=pe,this.init=function(){return W(r,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.initialized){t.next=5;break}return t.next=3,this.getKeyChain();case 3:k(e=t.sent)<"u"&&(this.keychain=e),this.initialized=!0;case 5:case"end":return t.stop()}}),t,this)})))},this.has=function(t){return r.isInitialized(),r.keychain.has(t)},this.set=function(t,e){return W(r,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.keychain.set(t,e),n.next=4,this.persist();case 4:case"end":return n.stop()}}),n,this)})))},this.get=function(t){r.isInitialized();var e=r.keychain.get(t);if(k(e)>"u"){var n=Object(h.A)("NO_MATCHING_KEY","".concat(r.name,": ").concat(t)).message;throw new Error(n)}return e},this.del=function(t){return W(r,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),this.keychain.delete(t),e.next=4,this.persist();case 4:case"end":return e.stop()}}),e,this)})))},this.core=e,this.logger=Object(s.a)(n,this.name)}),[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"setKeyChain",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,Object(h.ob)(t));case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getKeyChain",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return e=t.sent,t.abrupt("return",k(e)<"u"?Object(h.qb)(e):void 0);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setKeyChain(this.keychain);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}]),Ye=C((function t(e,n,r){var i=this;S(this,t),this.core=e,this.logger=n,this.name="crypto",this.initialized=!1,this.init=function(){return W(i,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=5;break}return t.next=4,this.keychain.init();case 4:this.initialized=!0;case 5:case"end":return t.stop()}}),t,this)})))},this.hasKeys=function(t){return i.isInitialized(),i.keychain.has(t)},this.getClientId=function(){return W(i,null,T().mark((function t(){var e,n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isInitialized(),t.next=3,this.getClientSeed();case 3:return e=t.sent,n=l.generateKeyPair(e),t.abrupt("return",l.encodeIss(n.publicKey));case 6:case"end":return t.stop()}}),t,this)})))},this.generateKeyPair=function(){i.isInitialized();var t=Object(h.t)();return i.setPrivateKey(t.publicKey,t.privateKey)},this.signJWT=function(t){return W(i,null,T().mark((function e(){var n,r,i,o;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.getClientSeed();case 3:return n=e.sent,r=l.generateKeyPair(n),i=Object(h.u)(),o=ge,e.next=9,l.signJWT(i,t,o,r);case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e,this)})))},this.generateSharedKey=function(t,e,n){i.isInitialized();var r=i.getPrivateKey(t),o=Object(h.k)(r,e);return i.setSymKey(o,n)},this.setSymKey=function(t,e){return W(i,null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),r=e||Object(h.I)(t),n.next=4,this.keychain.set(r,t);case 4:return n.abrupt("return",r);case 5:case"end":return n.stop()}}),n,this)})))},this.deleteKeyPair=function(t){return W(i,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.keychain.del(t);case 3:case"end":return e.stop()}}),e,this)})))},this.deleteSymKey=function(t){return W(i,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.keychain.del(t);case 3:case"end":return e.stop()}}),e,this)})))},this.encode=function(t,e,n){return W(i,null,T().mark((function r(){var i,o,a,s,u,l,d;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this.isInitialized(),i=Object(h.wb)(n),o=Object(c.b)(e),!Object(h.T)(i)){r.next=7;break}return a=i.senderPublicKey,s=i.receiverPublicKey,r.next=6,this.generateSharedKey(a,s);case 6:t=r.sent;case 7:return u=this.getSymKey(t),l=i.type,d=i.senderPublicKey,r.abrupt("return",Object(h.m)({type:l,symKey:u,message:o,senderPublicKey:d}));case 9:case"end":return r.stop()}}),r,this)})))},this.decode=function(t,e,n){return W(i,null,T().mark((function r(){var i,o,a,s,u;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this.isInitialized(),i=Object(h.vb)(e,n),!Object(h.T)(i)){r.next=7;break}return o=i.receiverPublicKey,a=i.senderPublicKey,r.next=6,this.generateSharedKey(o,a);case 6:t=r.sent;case 7:return r.prev=7,s=this.getSymKey(t),u=Object(h.j)({symKey:s,encoded:e}),r.abrupt("return",Object(c.a)(u));case 12:return r.prev=12,r.t0=r.catch(7),r.t1=this.logger,r.t2="Failed to decode message from topic: '".concat(t,"', clientId: '"),r.next=18,this.getClientId();case 18:r.t3=r.sent,r.t4=r.t2.concat.call(r.t2,r.t3,"'"),r.t1.error.call(r.t1,r.t4),this.logger.error(r.t0);case 22:case"end":return r.stop()}}),r,this,[[7,12]])})))},this.getPayloadType=function(t){var e=Object(h.l)(t);return Object(h.i)(e.type)},this.getPayloadSenderPublicKey=function(t){var e=Object(h.l)(t);return e.senderPublicKey?Object(d.toString)(e.senderPublicKey,h.a):void 0},this.core=e,this.logger=Object(s.a)(n,this.name),this.keychain=r||new Qe(this.core,this.logger)}),[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"setPrivateKey",value:function(t,e){return W(this,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.keychain.set(t,e);case 2:return n.abrupt("return",t);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"getPrivateKey",value:function(t){return this.keychain.get(t)}},{key:"getClientSeed",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e="",t.prev=1,e=this.keychain.get(me),t.next=10;break;case 5:return t.prev=5,t.t0=t.catch(1),e=Object(h.u)(),t.next=10,this.keychain.set(me,e);case 10:return t.abrupt("return",de(e,"base16"));case 11:case"end":return t.stop()}}),t,this,[[1,5]])})))}},{key:"getSymKey",value:function(t){return this.keychain.get(t)}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}]),We=function(t){function e(t,n){var r;return S(this,e),(r=A(this,e,[t,n])).logger=t,r.core=n,r.messages=new Map,r.name="messages",r.version="0.3",r.initialized=!1,r.storagePrefix=pe,r.init=function(){return W(N(r),null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.initialized){t.next=15;break}return this.logger.trace("Initialized"),t.prev=2,t.next=5,this.getRelayerMessages();case 5:k(e=t.sent)<"u"&&(this.messages=e),this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",size:this.messages.size}),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(2),this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(t.t0);case 12:return t.prev=12,this.initialized=!0,t.finish(12);case 15:case"end":return t.stop()}}),t,this,[[2,9,12,15]])})))},r.set=function(t,e){return W(N(r),null,T().mark((function n(){var r,i;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),r=Object(h.J)(e),k(i=this.messages.get(t))>"u"&&(i={}),n.t0=k(i[r])<"u",n.t0){n.next=10;break}return i[r]=e,this.messages.set(t,i),n.next=10,this.persist();case 10:return n.abrupt("return",r);case 11:case"end":return n.stop()}}),n,this)})))},r.get=function(t){r.isInitialized();var e=r.messages.get(t);return k(e)>"u"&&(e={}),e},r.has=function(t,e){return r.isInitialized(),k(r.get(t)[Object(h.J)(e)])<"u"},r.del=function(t){return W(N(r),null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),this.messages.delete(t),e.next=4,this.persist();case 4:case"end":return e.stop()}}),e,this)})))},r.logger=Object(s.a)(t,r.name),r.core=n,r}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"setRelayerMessages",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,Object(h.ob)(t));case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getRelayerMessages",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return e=t.sent,t.abrupt("return",k(e)<"u"?Object(h.qb)(e):void 0);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setRelayerMessages(this.messages);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.f),Fe=function(t){function e(t,n){var i;return S(this,e),(i=A(this,e,[t,n])).relayer=t,i.logger=n,i.events=new r.EventEmitter,i.name="publisher",i.queue=new Map,i.publishTimeout=Object(f.toMiliseconds)(f.ONE_MINUTE),i.failedPublishTimeout=Object(f.toMiliseconds)(f.ONE_SECOND),i.needsTransportRestart=!1,i.publish=function(t,e,n){return W(N(i),null,T().mark((function r(){var i,o,a,s,u,c,l,d,f,p,m,g=this;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:t,message:e,opts:n}}),o=(null==n?void 0:n.ttl)||ve,a=Object(h.F)(n),s=(null==n?void 0:n.prompt)||!1,u=(null==n?void 0:n.tag)||0,c=(null==n?void 0:n.id)||Object(y.getBigIntRpcId)().toString(),l={topic:t,message:e,opts:{ttl:o,relay:a,prompt:s,tag:u,id:c}},d="Failed to publish payload, please try again. id:".concat(c," tag:").concat(u),f=Date.now(),m=1,r.prev=3;case 4:if(void 0!==p){r.next=20;break}if(!(Date.now()-f>this.publishTimeout)){r.next=7;break}throw new Error(d);case 7:return this.logger.trace({id:c,attempts:m},"publisher.publish - attempt ".concat(m)),r.next=10,Object(h.h)(this.rpcPublish(t,e,o,a,s,u,c).catch((function(t){return g.logger.warn(t)})),this.publishTimeout,d);case 10:return r.next=12,r.sent;case 12:if(p=r.sent,m++,r.t0=p,r.t0){r.next=18;break}return r.next=18,new Promise((function(t){return setTimeout(t,g.failedPublishTimeout)}));case 18:r.next=4;break;case 20:this.relayer.events.emit(Ae.publish,l),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:c,topic:t,message:e,opts:n}}),r.next=28;break;case 23:if(r.prev=23,r.t1=r.catch(3),this.logger.debug("Failed to Publish Payload"),this.logger.error(r.t1),null==(i=null==n?void 0:n.internal)||!i.throwOnFailedPublish){r.next=27;break}throw r.t1;case 27:this.queue.set(c,l);case 28:case"end":return r.stop()}}),r,this,[[3,23]])})))},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.relayer=t,i.logger=Object(s.a)(n,i.name),i.registerEventListeners(),i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"rpcPublish",value:function(t,e,n,r,i,o,a){var s,u,c,l,d={method:Object(h.E)(r.protocol).publish,params:{topic:t,message:e,ttl:n,prompt:i,tag:o},id:a};return Object(h.U)(null==(s=d.params)?void 0:s.prompt)&&(null==(u=d.params)||delete u.prompt),Object(h.U)(null==(c=d.params)?void 0:c.tag)&&(null==(l=d.params)||delete l.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}},{key:"removeRequestFromQueue",value:function(t){this.queue.delete(t)}},{key:"checkQueue",value:function(){var t=this;this.queue.forEach((function(e){return W(t,null,T().mark((function t(){var n,r,i;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.topic,r=e.message,i=e.opts,t.next=3,this.publish(n,r,i);case 3:case"end":return t.stop()}}),t,this)})))}))}},{key:"registerEventListeners",value:function(){var t=this;this.relayer.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){if(t.needsTransportRestart)return t.needsTransportRestart=!1,void t.relayer.events.emit(Ae.connection_stalled);t.checkQueue()})),this.relayer.on(Ae.message_ack,(function(e){t.removeRequestFromQueue(e.id.toString())}))}}])}(u.g),Ve=C((function t(){var e=this;S(this,t),this.map=new Map,this.set=function(t,n){var r=e.get(t);e.exists(t,n)||e.map.set(t,[].concat(M(r),[n]))},this.get=function(t){return e.map.get(t)||[]},this.exists=function(t,n){return e.get(t).includes(n)},this.delete=function(t,n){if(k(n)>"u")e.map.delete(t);else if(e.map.has(t)){var r=e.get(t);if(e.exists(t,n)){var i=r.filter((function(t){return t!==n}));i.length?e.map.set(t,i):e.map.delete(t)}}},this.clear=function(){e.map.clear()}}),[{key:"topics",get:function(){return Array.from(this.map.keys())}}]),He=Object.defineProperty,Ge=Object.defineProperties,qe=Object.getOwnPropertyDescriptors,Ze=Object.getOwnPropertySymbols,Je=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,Ke=function(t,e,n){return e in t?He(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},$e=function(t,e){for(var n in e||(e={}))Je.call(e,n)&&Ke(t,n,e[n]);if(Ze){var r,i=O(Ze(e));try{for(i.s();!(r=i.n()).done;)n=r.value,Xe.call(e,n)&&Ke(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},tn=function(t,e){return Ge(t,qe(e))},en=function(t){function e(t,n){var i;return S(this,e),(i=A(this,e,[t,n])).relayer=t,i.logger=n,i.subscriptions=new Map,i.topicMap=new Ve,i.events=new r.EventEmitter,i.name="subscription",i.version="0.3",i.pending=new Map,i.cached=[],i.initialized=!1,i.pendingSubscriptionWatchLabel="pending_sub_watch_label",i.pollingInterval=20,i.storagePrefix=pe,i.subscribeTimeout=Object(f.toMiliseconds)(f.ONE_MINUTE),i.restartInProgress=!1,i.batchSubscribeTopicsLimit=500,i.init=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=7;break}return this.logger.trace("Initialized"),this.registerEventListeners(),t.next=6,this.relayer.core.crypto.getClientId();case 6:this.clientId=t.sent;case 7:case"end":return t.stop()}}),t,this)})))},i.subscribe=function(t,e){return W(N(i),null,T().mark((function n(){var r,i,o;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.restartToComplete();case 2:return this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:t,opts:e}}),n.prev=5,r=Object(h.F)(e),i={topic:t,relay:r},this.pending.set(t,i),n.next=10,this.rpcSubscribe(t,r);case 10:return o=n.sent,n.abrupt("return",("string"==typeof o&&(this.onSubscribe(o,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:t,opts:e}})),o));case 14:throw n.prev=14,n.t0=n.catch(5),this.logger.debug("Failed to Subscribe Topic"),this.logger.error(n.t0),n.t0;case 17:case"end":return n.stop()}}),n,this,[[5,14]])})))},i.unsubscribe=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.restartToComplete();case 2:if(this.isInitialized(),!(k(null==e?void 0:e.id)<"u")){n.next=8;break}return n.next=6,this.unsubscribeById(t,e.id,e);case 6:n.next=10;break;case 8:return n.next=10,this.unsubscribeByTopic(t,e);case 10:case"end":return n.stop()}}),n,this)})))},i.isSubscribed=function(t){return W(N(i),null,T().mark((function e(){var n,r=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.topics.includes(t)){e.next=2;break}return e.abrupt("return",!0);case 2:return n="".concat(this.pendingSubscriptionWatchLabel,"_").concat(t),e.next=5,new Promise((function(e,i){var o=new f.Watch;o.start(n);var a=setInterval((function(){!r.pending.has(t)&&r.topics.includes(t)&&(clearInterval(a),o.stop(n),e(!0)),o.elapsed(n)>=Se&&(clearInterval(a),o.stop(n),i(new Error("Subscription resolution timeout")))}),r.pollingInterval)})).catch((function(){return!1}));case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})))},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.start=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.onConnect();case 2:case"end":return t.stop()}}),t,this)})))},i.stop=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.onDisconnect();case 2:case"end":return t.stop()}}),t,this)})))},i.restart=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.restartInProgress=!0,t.next=3,this.restore();case 3:return t.next=5,this.reset();case 5:this.restartInProgress=!1;case 6:case"end":return t.stop()}}),t,this)})))},i.relayer=t,i.logger=Object(s.a)(n,i.name),i.clientId="",i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.subscriptions.size}},{key:"ids",get:function(){return Array.from(this.subscriptions.keys())}},{key:"values",get:function(){return Array.from(this.subscriptions.values())}},{key:"topics",get:function(){return this.topicMap.topics}},{key:"hasSubscription",value:function(t,e){var n=!1;try{n=this.getSubscription(t).topic===e}catch(t){}return n}},{key:"onEnable",value:function(){this.cached=[],this.initialized=!0}},{key:"onDisable",value:function(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}},{key:"unsubscribeByTopic",value:function(t,e){return W(this,null,T().mark((function n(){var r,i=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=this.topicMap.get(t),n.next=3,Promise.all(r.map((function(n){return W(i,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.unsubscribeById(t,n,e);case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))})));case 3:case"end":return n.stop()}}),n,this)})))}},{key:"unsubscribeById",value:function(t,e,n){return W(this,null,T().mark((function r(){var i,o;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}}),r.prev=1,i=Object(h.F)(n),r.next=5,this.rpcUnsubscribe(t,e,i);case 5:return o=Object(h.G)("USER_DISCONNECTED","".concat(this.name,", ").concat(t)),r.next=8,this.onUnsubscribe(t,e,o);case 8:this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}}),r.next=15;break;case 12:throw r.prev=12,r.t0=r.catch(1),this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(r.t0),r.t0;case 15:case"end":return r.stop()}}),r,this,[[1,12]])})))}},{key:"rpcSubscribe",value:function(t,e){return W(this,null,T().mark((function n(){var r,i=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r={method:Object(h.E)(e.protocol).subscribe,params:{topic:t}},this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),n.prev=2,n.next=5,Object(h.h)(this.relayer.request(r).catch((function(t){return i.logger.warn(t)})),this.subscribeTimeout);case 5:return n.next=7,n.sent;case 7:if(!n.sent){n.next=11;break}n.t0=Object(h.J)(t+this.clientId),n.next=12;break;case 11:n.t0=null;case 12:return n.abrupt("return",n.t0);case 15:n.prev=15,n.t1=n.catch(2),this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ae.connection_stalled);case 18:return n.abrupt("return",null);case 19:case"end":return n.stop()}}),n,this,[[2,15]])})))}},{key:"rpcBatchSubscribe",value:function(t){return W(this,null,T().mark((function e(){var n,r,i=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length){e.next=2;break}return e.abrupt("return");case 2:return n=t[0].relay,r={method:Object(h.E)(n.protocol).batchSubscribe,params:{topics:t.map((function(t){return t.topic}))}},this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),e.prev=4,e.next=7,Object(h.h)(this.relayer.request(r).catch((function(t){return i.logger.warn(t)})),this.subscribeTimeout);case 7:return e.next=9,e.sent;case 9:return e.abrupt("return",e.sent);case 12:e.prev=12,e.t0=e.catch(4),this.relayer.events.emit(Ae.connection_stalled);case 15:case"end":return e.stop()}}),e,this,[[4,12]])})))}},{key:"rpcUnsubscribe",value:function(t,e,n){var r={method:Object(h.E)(n.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}},{key:"onSubscribe",value:function(t,e){this.setSubscription(t,tn($e({},e),{id:t})),this.pending.delete(e.topic)}},{key:"onBatchSubscribe",value:function(t){var e=this;t.length&&t.forEach((function(t){e.setSubscription(t.id,$e({},t)),e.pending.delete(t.topic)}))}},{key:"onUnsubscribe",value:function(t,e,n){return W(this,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,n),r.next=4,this.relayer.messages.del(t);case 4:case"end":return r.stop()}}),r,this)})))}},{key:"setRelayerSubscriptions",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.relayer.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getRelayerSubscriptions",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.relayer.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"setSubscription",value:function(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}},{key:"addSubscription",value:function(t,e){this.subscriptions.set(t,$e({},e)),this.topicMap.set(e.topic,t),this.events.emit(Te,e)}},{key:"getSubscription",value:function(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});var e=this.subscriptions.get(t);if(!e){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw new Error(n)}return e}},{key:"deleteSubscription",value:function(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});var n=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(n.topic,t),this.events.emit(Le,tn($e({},n),{reason:e}))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setRelayerSubscriptions(this.values);case 2:this.events.emit("subscription_sync");case 3:case"end":return t.stop()}}),t,this)})))}},{key:"reset",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.cached.length){t.next=10;break}e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit),n=0;case 3:if(!(n"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.subscriptions.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),this.logger.error("".concat(this.name,": ").concat(JSON.stringify(this.values))),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored subscriptions for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",subscriptions:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore subscriptions for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"batchSubscribe",value:function(t){return W(this,null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.rpcBatchSubscribe(t);case 4:n=e.sent,Object(h.V)(n)&&this.onBatchSubscribe(n.map((function(e,n){return tn($e({},t[n]),{id:e})})));case 6:case"end":return e.stop()}}),e,this)})))}},{key:"onConnect",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.restart();case 2:this.onEnable();case 3:case"end":return t.stop()}}),t,this)})))}},{key:"onDisconnect",value:function(){this.onDisable()}},{key:"checkPending",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.initialized&&this.relayer.connected){t.next=2;break}return t.abrupt("return");case 2:return e=[],this.pending.forEach((function(t){e.push(t)})),t.next=6,this.batchSubscribe(e);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"registerEventListeners",value:function(){var t=this;this.relayer.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){return W(t,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.checkPending();case 2:case"end":return t.stop()}}),t,this)})))})),this.events.on(Te,(function(e){return W(t,null,T().mark((function t(){var n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Te,this.logger.info("Emitting ".concat(n)),this.logger.debug({type:"event",event:n,data:e}),t.next=5,this.persist();case 5:case"end":return t.stop()}}),t,this)})))})),this.events.on(Le,(function(e){return W(t,null,T().mark((function t(){var n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Le,this.logger.info("Emitting ".concat(n)),this.logger.debug({type:"event",event:n,data:e}),t.next=5,this.persist();case 5:case"end":return t.stop()}}),t,this)})))}))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}},{key:"restartToComplete",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.restartInProgress,!t.t0){t.next=4;break}return t.next=4,new Promise((function(t){var n=setInterval((function(){e.restartInProgress||(clearInterval(n),t())}),e.pollingInterval)}));case 4:case"end":return t.stop()}}),t,this)})))}}])}(u.k),nn=Object.defineProperty,rn=Object.getOwnPropertySymbols,on=Object.prototype.hasOwnProperty,an=Object.prototype.propertyIsEnumerable,sn=function(t,e,n){return e in t?nn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},un=function(t,e){for(var n in e||(e={}))on.call(e,n)&&sn(t,n,e[n]);if(rn){var r,i=O(rn(e));try{for(i.s();!(r=i.n()).done;)n=r.value,an.call(e,n)&&sn(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},cn=function(t){function e(t){var n;return S(this,e),(n=A(this,e,[t])).protocol="wc",n.version=2,n.events=new r.EventEmitter,n.name="relayer",n.transportExplicitlyClosed=!1,n.initialized=!1,n.connectionAttemptInProgress=!1,n.connectionStatusPollingInterval=20,n.staleConnectionErrors=["socket hang up","socket stalled","interrupted"],n.hasExperiencedNetworkDisruption=!1,n.requestsInFlight=new Map,n.heartBeatTimeout=Object(f.toMiliseconds)(f.THIRTY_SECONDS+f.ONE_SECOND),n.request=function(t){return W(N(n),null,T().mark((function e(){var n,r,i,o,a,s=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.debug("Publishing Request Payload"),i=t.id||Object(y.getBigIntRpcId)().toString(),e.next=4,this.toEstablishConnection();case 4:return e.prev=4,o=this.provider.request(t),this.requestsInFlight.set(i,{promise:o,request:t}),this.logger.trace({id:i,method:t.method,topic:null==(n=t.params)?void 0:n.topic},"relayer.request - attempt to publish..."),e.next=9,new Promise((function(t,e){return W(s,null,T().mark((function n(){var r,a;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function(){e(new Error("relayer.request - publish interrupted, id: ".concat(i)))},this.provider.on(Ee,r),n.next=4,o;case 4:a=n.sent,this.provider.off(Ee,r),t(a);case 6:case"end":return n.stop()}}),n,this)})))}));case 9:return a=e.sent,e.abrupt("return",(this.logger.trace({id:i,method:t.method,topic:null==(r=t.params)?void 0:r.topic},"relayer.request - published"),a));case 13:throw e.prev=13,e.t0=e.catch(4),this.logger.debug("Failed to Publish Request: ".concat(i)),e.t0;case 16:return e.prev=16,this.requestsInFlight.delete(i),e.finish(16);case 19:case"end":return e.stop()}}),e,this,[[4,13,16,19]])})))},n.resetPingTimeout=function(){if(Object(h.N)())try{clearTimeout(n.pingTimeout),n.pingTimeout=setTimeout((function(){var t,e,r;null==(r=null==(e=null==(t=n.provider)?void 0:t.connection)?void 0:e.socket)||r.terminate()}),n.heartBeatTimeout)}catch(t){n.logger.warn(t)}},n.onPayloadHandler=function(t){n.onProviderPayload(t),n.resetPingTimeout()},n.onConnectHandler=function(){n.startPingTimeout(),n.events.emit(Ae.connect)},n.onDisconnectHandler=function(){n.onProviderDisconnect()},n.onProviderErrorHandler=function(t){n.logger.error(t),n.events.emit(Ae.error,t),n.logger.info("Fatal socket error received, closing transport"),n.transportClose()},n.registerProviderListeners=function(){n.provider.on(Ne,n.onPayloadHandler),n.provider.on(Ie,n.onConnectHandler),n.provider.on(Ee,n.onDisconnectHandler),n.provider.on(xe,n.onProviderErrorHandler)},n.core=t.core,n.logger=k(t.logger)<"u"&&"string"!=typeof t.logger?Object(s.a)(t.logger,n.name):Object(s.e)(Object(s.c)({level:t.logger||"error"})),n.messages=new We(n.logger,t.core),n.subscriber=new en(N(n),n.logger),n.publisher=new Fe(N(n),n.logger),n.relayUrl=(null==t?void 0:t.relayUrl)||be,n.projectId=t.projectId,n.bundleId=Object(h.w)(),n.provider={},n}return E(e,t),C(e,[{key:"init",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.logger.trace("Initialized"),this.registerEventListeners(),t.next=4,this.createProvider();case 4:return t.next=6,Promise.all([this.messages.init(),this.subscriber.init()]);case 6:return t.prev=6,t.next=9,this.transportOpen();case 9:t.next=16;break;case 11:return t.prev=11,t.t0=t.catch(6),this.logger.warn("Connection via ".concat(this.relayUrl," failed, attempting to connect via failover domain ").concat(Me,"...")),t.next=16,this.restartTransport(Me);case 16:this.initialized=!0,setTimeout((function(){return W(e,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=0===this.subscriber.topics.length&&0===this.subscriber.pending.size,!t.t0){t.next=6;break}return this.logger.info("No topics subscribed to after init, closing transport"),t.next=5,this.transportClose();case 5:this.transportExplicitlyClosed=!1;case 6:case"end":return t.stop()}}),t,this)})))}),1e4);case 17:case"end":return t.stop()}}),t,this,[[6,11]])})))}},{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"connected",get:function(){var t,e,n;return 1===(null==(n=null==(e=null==(t=this.provider)?void 0:t.connection)?void 0:e.socket)?void 0:n.readyState)}},{key:"connecting",get:function(){var t,e,n;return 0===(null==(n=null==(e=null==(t=this.provider)?void 0:t.connection)?void 0:e.socket)?void 0:n.readyState)}},{key:"publish",value:function(t,e,n){return W(this,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.isInitialized(),r.next=3,this.publisher.publish(t,e,n);case 3:return r.next=5,this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now()});case 5:case"end":return r.stop()}}),r,this)})))}},{key:"subscribe",value:function(t,e){return W(this,null,T().mark((function n(){var r,i,o,a,s=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),i=(null==(r=this.subscriber.topicMap.get(t))?void 0:r[0])||"",a=function e(n){n.topic===t&&(s.subscriber.off(Te,e),o())},n.next=5,Promise.all([new Promise((function(t){o=t,s.subscriber.on(Te,a)})),new Promise((function(n){return W(s,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.subscriber.subscribe(t,e);case 2:if(r.t0=r.sent,r.t0){r.next=5;break}r.t0=i;case 5:i=r.t0,n();case 7:case"end":return r.stop()}}),r,this)})))}))]);case 5:return n.abrupt("return",i);case 6:case"end":return n.stop()}}),n,this)})))}},{key:"unsubscribe",value:function(t,e){return W(this,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),n.next=3,this.subscriber.unsubscribe(t,e);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"on",value:function(t,e){this.events.on(t,e)}},{key:"once",value:function(t,e){this.events.once(t,e)}},{key:"off",value:function(t,e){this.events.off(t,e)}},{key:"removeListener",value:function(t,e){this.events.removeListener(t,e)}},{key:"transportDisconnect",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)){t.next=9;break}return t.prev=1,t.next=4,Promise.all(Array.from(this.requestsInFlight.values()).map((function(t){return t.promise})));case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),this.logger.warn(t.t0);case 9:if(!this.hasExperiencedNetworkDisruption&&!this.connected){t.next=14;break}return t.next=12,Object(h.h)(this.provider.disconnect(),2e3,"provider.disconnect()").catch((function(){return e.onProviderDisconnect()}));case 12:t.next=15;break;case 14:this.onProviderDisconnect();case 15:case"end":return t.stop()}}),t,this,[[1,6]])})))}},{key:"transportClose",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.transportExplicitlyClosed=!0,t.next=3,this.transportDisconnect();case 3:case"end":return t.stop()}}),t,this)})))}},{key:"transportOpen",value:function(t){return W(this,null,T().mark((function e(){var n,r=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.confirmOnlineStateOrThrow();case 2:if(e.t0=t&&t!==this.relayUrl,!e.t0){e.next=9;break}return this.relayUrl=t,e.next=7,this.transportDisconnect();case 7:return e.next=9,this.createProvider();case 9:return this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1,e.prev=11,e.next=14,new Promise((function(t,e){return W(r,null,T().mark((function n(){var r,i=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function t(){i.provider.off(Ee,t),e(new Error("Connection interrupted while trying to subscribe"))},this.provider.on(Ee,r),n.next=4,Object(h.h)(this.provider.connect(),Object(f.toMiliseconds)(f.ONE_MINUTE),"Socket stalled when trying to connect to ".concat(this.relayUrl)).catch((function(t){e(t)}));case 4:return n.next=6,this.subscriber.start();case 6:this.hasExperiencedNetworkDisruption=!1,t();case 8:case"end":return n.stop()}}),n,this)})))}));case 14:e.next=22;break;case 16:if(e.prev=16,e.t1=e.catch(11),this.logger.error(e.t1),n=e.t1,this.isConnectionStalled(n.message)){e.next=22;break}throw e.t1;case 22:return e.prev=22,this.connectionAttemptInProgress=!1,e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[11,16,22,25]])})))}},{key:"restartTransport",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.connectionAttemptInProgress,e.t0){e.next=11;break}return this.relayUrl=t||this.relayUrl,e.next=5,this.confirmOnlineStateOrThrow();case 5:return e.next=7,this.transportClose();case 7:return e.next=9,this.createProvider();case 9:return e.next=11,this.transportOpen();case 11:case"end":return e.stop()}}),e,this)})))}},{key:"confirmOnlineStateOrThrow",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(h.O)();case 2:if(t.sent){t.next=4;break}throw new Error("No internet connection detected. Please restart your network and try again.");case 4:case"end":return t.stop()}}),t)})))}},{key:"startPingTimeout",value:function(){var t,e,n,r,i,o=this;if(Object(h.N)())try{null!=(e=null==(t=this.provider)?void 0:t.connection)&&e.socket&&(null==(i=null==(r=null==(n=this.provider)?void 0:n.connection)?void 0:r.socket)||i.once("ping",(function(){o.resetPingTimeout()}))),this.resetPingTimeout()}catch(t){this.logger.warn(t)}}},{key:"isConnectionStalled",value:function(t){return this.staleConnectionErrors.some((function(e){return t.includes(e)}))}},{key:"createProvider",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.provider.connection&&this.unregisterProviderListeners(),t.next=3,this.core.crypto.signJWT(this.relayUrl);case 3:e=t.sent,this.provider=new p.a(new m.a(Object(h.q)({sdkVersion:"2.12.2",protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners();case 5:case"end":return t.stop()}}),t,this)})))}},{key:"recordMessageEvent",value:function(t){return W(this,null,T().mark((function e(){var n,r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,r=t.message,e.next=3,this.messages.set(n,r);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"shouldIgnoreMessageEvent",value:function(t){return W(this,null,T().mark((function e(){var n,r,i;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.topic,(r=t.message)&&0!==r.length){e.next=3;break}return e.abrupt("return",(this.logger.debug("Ignoring invalid/empty message: ".concat(r)),!0));case 3:return e.next=5,this.subscriber.isSubscribed(n);case 5:if(e.sent){e.next=7;break}return e.abrupt("return",(this.logger.debug("Ignoring message for non-subscribed topic ".concat(n)),!0));case 7:return i=this.messages.has(n,r),e.abrupt("return",(i&&this.logger.debug("Ignoring duplicate message: ".concat(r)),i));case 9:case"end":return e.stop()}}),e,this)})))}},{key:"onProviderPayload",value:function(t){return W(this,null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),!Object(y.isJsonRpcRequest)(t)){e.next=13;break}if(t.method.endsWith("_subscription")){e.next=3;break}return e.abrupt("return");case 3:return n=t.params,r=n.data,i=r.topic,o=r.message,a=r.publishedAt,s={topic:i,message:o,publishedAt:a},this.logger.debug("Emitting Relayer Payload"),this.logger.trace(un({type:"event",event:n.id},s)),this.events.emit(n.id,s),e.next=9,this.acknowledgePayload(t);case 9:return e.next=11,this.onMessageEvent(s);case 11:e.next=14;break;case 13:Object(y.isJsonRpcResponse)(t)&&this.events.emit(Ae.message_ack,t);case 14:case"end":return e.stop()}}),e,this)})))}},{key:"onMessageEvent",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.shouldIgnoreMessageEvent(t);case 2:if(e.t0=e.sent,e.t0){e.next=7;break}return this.events.emit(Ae.message,t),e.next=7,this.recordMessageEvent(t);case 7:case"end":return e.stop()}}),e,this)})))}},{key:"acknowledgePayload",value:function(t){return W(this,null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(y.formatJsonRpcResult)(t.id,!0),e.next=3,this.provider.connection.send(n);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"unregisterProviderListeners",value:function(){this.provider.off(Ne,this.onPayloadHandler),this.provider.off(Ie,this.onConnectHandler),this.provider.off(Ee,this.onDisconnectHandler),this.provider.off(xe,this.onProviderErrorHandler)}},{key:"registerEventListeners",value:function(){return W(this,null,T().mark((function t(){var e,n=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(h.O)();case 2:e=t.sent,Object(h.ub)((function(t){return W(n,null,T().mark((function n(){var r=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.t0=e!==t,!n.t0){n.next=12;break}if(e=t,!t){n.next=8;break}return n.next=6,this.restartTransport().catch((function(t){return r.logger.error(t)}));case 6:n.next=12;break;case 8:return this.hasExperiencedNetworkDisruption=!0,n.next=11,this.transportDisconnect();case 11:this.transportExplicitlyClosed=!1;case 12:case"end":return n.stop()}}),n,this)})))}));case 4:case"end":return t.stop()}}),t)})))}},{key:"onProviderDisconnect",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.subscriber.stop();case 2:this.events.emit(Ae.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout((function(){return W(e,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.transportOpen().catch((function(t){return e.logger.error(t)}));case 2:case"end":return t.stop()}}),t,this)})))}),Object(f.toMiliseconds)(ke));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}},{key:"toEstablishConnection",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.confirmOnlineStateOrThrow();case 2:if(t.t0=!this.connected,!t.t0){t.next=10;break}if(t.t1=this.connectionAttemptInProgress,!t.t1){t.next=8;break}return t.next=8,new Promise((function(t){var n=setInterval((function(){e.connected&&(clearInterval(n),t())}),e.connectionStatusPollingInterval)}));case 8:return t.next=10,this.transportOpen();case 10:case"end":return t.stop()}}),t,this)})))}}])}(u.h),ln=Object.defineProperty,hn=Object.getOwnPropertySymbols,dn=Object.prototype.hasOwnProperty,fn=Object.prototype.propertyIsEnumerable,pn=function(t,e,n){return e in t?ln(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},yn=function(t,e){for(var n in e||(e={}))dn.call(e,n)&&pn(t,n,e[n]);if(hn){var r,i=O(hn(e));try{for(i.s();!(r=i.n()).done;)n=r.value,fn.call(e,n)&&pn(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},mn=function(t){function e(t,n,r){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:pe,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;return S(this,e),(i=A(this,e,[t,n,r,o])).core=t,i.logger=n,i.name=r,i.map=new Map,i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=pe,i.recentlyDeleted=[],i.recentlyDeletedLimit=200,i.init=function(){return W(N(i),null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=8;break}return this.logger.trace("Initialized"),t.next=5,this.restore();case 5:this.cached.forEach((function(t){e.getKey&&null!==t&&!Object(h.U)(t)?e.map.set(e.getKey(t),t):Object(h.P)(t)?e.map.set(t.id,t):Object(h.S)(t)&&e.map.set(t.topic,t)})),this.cached=[],this.initialized=!0;case 8:case"end":return t.stop()}}),t,this)})))},i.set=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),!this.map.has(t)){n.next=6;break}return n.next=4,this.update(t,e);case 4:n.next=11;break;case 6:return this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:t,value:e}),this.map.set(t,e),n.next=11,this.persist();case 11:case"end":return n.stop()}}),n,this)})))},i.get=function(t){return i.isInitialized(),i.logger.debug("Getting value"),i.logger.trace({type:"method",method:"get",key:t}),i.getData(t)},i.getAll=function(t){return i.isInitialized(),t?i.values.filter((function(e){return Object.keys(t).every((function(n){return v()(e[n],t[n])}))})):i.values},i.update=function(t,e){return W(N(i),null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:t,update:e}),r=yn(yn({},this.getData(t)),e),this.map.set(t,r),n.next=5,this.persist();case 5:case"end":return n.stop()}}),n,this)})))},i.delete=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),n.t0=this.map.has(t),!n.t0){n.next=9;break}return this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:t,reason:e}),this.map.delete(t),this.addToRecentlyDeleted(t),n.next=9,this.persist();case 9:case"end":return n.stop()}}),n,this)})))},i.logger=Object(s.a)(n,i.name),i.storagePrefix=o,i.getKey=a,i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.map.size}},{key:"keys",get:function(){return Array.from(this.map.keys())}},{key:"values",get:function(){return Array.from(this.map.values())}},{key:"addToRecentlyDeleted",value:function(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}},{key:"setDataStore",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getDataStore",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getData",value:function(t){var e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){var n=Object(h.A)("MISSING_OR_INVALID","Record was recently deleted - ".concat(this.name,": ").concat(t)).message;throw this.logger.error(n),new Error(n)}var r=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw this.logger.error(r),new Error(r)}return e}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setDataStore(this.values);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getDataStore();case 3:if(!(k(e=t.sent)>"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.map.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored value for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",value:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore value for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.j),gn=C((function t(e,n){var r=this;S(this,t),this.core=e,this.logger=n,this.name="pairing",this.version="0.3",this.events=new i.a,this.initialized=!1,this.storagePrefix=pe,this.ignoredPayloadTypes=[h.c],this.registeredMethods=[],this.init=function(){return W(r,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=10;break}return t.next=4,this.pairings.init();case 4:return t.next=6,this.cleanup();case 6:this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized");case 10:case"end":return t.stop()}}),t,this)})))},this.register=function(t){var e=t.methods;r.isInitialized(),r.registeredMethods=M(new Set([].concat(M(r.registeredMethods),M(e))))},this.create=function(t){return W(r,null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),n=Object(h.u)(),e.next=4,this.core.crypto.setSymKey(n);case 4:return r=e.sent,i=Object(h.e)(f.FIVE_MINUTES),a={topic:r,expiry:i,relay:o={protocol:we},active:!1},s=Object(h.s)({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:n,relay:o,expiryTimestamp:i,methods:null==t?void 0:t.methods}),e.next=11,this.pairings.set(r,a);case 11:return e.next=13,this.core.relayer.subscribe(r);case 13:return this.core.expirer.set(r,i),e.abrupt("return",{topic:r,uri:s});case 15:case"end":return e.stop()}}),e,this)})))},this.pair=function(t){return W(r,null,T().mark((function e(){var n,r,i,o,a,s,u,c;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isInitialized(),this.isValidPair(t),n=Object(h.tb)(t.uri),r=n.topic,i=n.symKey,o=n.relay,a=n.expiryTimestamp,s=n.methods,!this.pairings.keys.includes(r)||!this.pairings.get(r).active){e.next=4;break}throw new Error("Pairing already exists: ".concat(r,". Please try again with a new connection URI."));case 4:return u=a||Object(h.e)(f.FIVE_MINUTES),c={topic:r,relay:o,expiry:u,active:!1,methods:s},e.next=7,this.pairings.set(r,c);case 7:if(this.core.expirer.set(r,u),e.t0=t.activatePairing,!e.t0){e.next=12;break}return e.next=12,this.activate({topic:r});case 12:if(this.events.emit(Ce.create,c),e.t1=this.core.crypto.keychain.has(r),e.t1){e.next=17;break}return e.next=17,this.core.crypto.setSymKey(i,r);case 17:return e.next=19,this.core.relayer.subscribe(r,{relay:o});case 19:return e.abrupt("return",c);case 20:case"end":return e.stop()}}),e,this)})))},this.activate=function(t){return W(r,[t],(function(t){var e=this,n=t.topic;return T().mark((function t(){var r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isInitialized(),r=Object(h.e)(f.THIRTY_DAYS),t.next=4,e.pairings.update(n,{active:!0,expiry:r});case 4:e.core.expirer.set(n,r);case 5:case"end":return t.stop()}}),t)}))()}))},this.ping=function(t){return W(r,null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.isValidPing(t);case 3:if(n=t.topic,!this.pairings.keys.includes(n)){e.next=15;break}return e.next=7,this.sendRequest(n,"wc_pairingPing",{});case 7:return r=e.sent,i=Object(h.f)(),o=i.done,a=i.resolve,s=i.reject,this.events.once(Object(h.n)("pairing_ping",r),(function(t){var e=t.error;e?s(e):a()})),e.next=15,o();case 15:case"end":return e.stop()}}),e,this)})))},this.updateExpiry=function(t){return W(r,[t],(function(t){var e=this,n=t.topic,r=t.expiry;return T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isInitialized(),t.next=3,e.pairings.update(n,{expiry:r});case 3:case"end":return t.stop()}}),t)}))()}))},this.updateMetadata=function(t){return W(r,[t],(function(t){var e=this,n=t.topic,r=t.metadata;return T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isInitialized(),t.next=3,e.pairings.update(n,{peerMetadata:r});case 3:case"end":return t.stop()}}),t)}))()}))},this.getPairings=function(){return r.isInitialized(),r.pairings.values},this.disconnect=function(t){return W(r,null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.isValidDisconnect(t);case 3:if(n=t.topic,e.t0=this.pairings.keys.includes(n),!e.t0){e.next=10;break}return e.next=8,this.sendRequest(n,"wc_pairingDelete",Object(h.G)("USER_DISCONNECTED"));case 8:return e.next=10,this.deletePairing(n);case 10:case"end":return e.stop()}}),e,this)})))},this.sendRequest=function(t,e,n){return W(r,null,T().mark((function r(){var i,o,a;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcRequest)(e,n),r.next=3,this.core.crypto.encode(t,i);case 3:return o=r.sent,a=je[e].req,r.abrupt("return",(this.core.history.set(t,i),this.core.relayer.publish(t,o,a),i.id));case 6:case"end":return r.stop()}}),r,this)})))},this.sendResult=function(t,e,n){return W(r,null,T().mark((function r(){var i,o,a,s;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcResult)(t,n),r.next=3,this.core.crypto.encode(e,i);case 3:return o=r.sent,r.next=6,this.core.history.get(e,t);case 6:return a=r.sent,s=je[a.request.method].res,r.next=10,this.core.relayer.publish(e,o,s);case 10:return r.next=12,this.core.history.resolve(i);case 12:case"end":return r.stop()}}),r,this)})))},this.sendError=function(t,e,n){return W(r,null,T().mark((function r(){var i,o,a,s;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcError)(t,n),r.next=3,this.core.crypto.encode(e,i);case 3:return o=r.sent,r.next=6,this.core.history.get(e,t);case 6:return a=r.sent,s=je[a.request.method]?je[a.request.method].res:je.unregistered_method.res,r.next=10,this.core.relayer.publish(e,o,s);case 10:return r.next=12,this.core.history.resolve(i);case 12:case"end":return r.stop()}}),r,this)})))},this.deletePairing=function(t,e){return W(r,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.core.relayer.unsubscribe(t);case 2:return n.next=4,Promise.all([this.pairings.delete(t,Object(h.G)("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(t),e?Promise.resolve():this.core.expirer.del(t)]);case 4:case"end":return n.stop()}}),n,this)})))},this.cleanup=function(){return W(r,null,T().mark((function t(){var e,n=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.pairings.getAll().filter((function(t){return Object(h.M)(t.expiry)})),t.next=3,Promise.all(e.map((function(t){return n.deletePairing(t.topic)})));case 3:case"end":return t.stop()}}),t,this)})))},this.onRelayEventRequest=function(t){var e=t.topic,n=t.payload;switch(n.method){case"wc_pairingPing":return r.onPairingPingRequest(e,n);case"wc_pairingDelete":return r.onPairingDeleteRequest(e,n);default:return r.onUnknownRpcMethodRequest(e,n)}},this.onRelayEventResponse=function(t){return W(r,null,T().mark((function e(){var n,r,i;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,r=t.payload,e.next=4,this.core.history.get(n,r.id);case 4:i=e.sent.request.method,e.t0=i,e.next="wc_pairingPing"===e.t0?8:9;break;case 8:return e.abrupt("return",this.onPairingPingResponse(n,r));case 9:return e.abrupt("return",this.onUnknownRpcMethodResponse(i));case 10:case"end":return e.stop()}}),e,this)})))},this.onPairingPingRequest=function(t,e){return W(r,null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.id,n.prev=1,this.isValidPing({topic:t}),n.next=5,this.sendResult(r,t,!0);case 5:this.events.emit(Ce.ping,{id:r,topic:t}),n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(1),n.next=12,this.sendError(r,t,n.t0);case 12:this.logger.error(n.t0);case 13:case"end":return n.stop()}}),n,this,[[1,8]])})))},this.onPairingPingResponse=function(t,e){var n=e.id;setTimeout((function(){Object(y.isJsonRpcResult)(e)?r.events.emit(Object(h.n)("pairing_ping",n),{}):Object(y.isJsonRpcError)(e)&&r.events.emit(Object(h.n)("pairing_ping",n),{error:e.error})}),500)},this.onPairingDeleteRequest=function(t,e){return W(r,null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.id,n.prev=1,this.isValidDisconnect({topic:t}),n.next=5,this.deletePairing(t);case 5:this.events.emit(Ce.delete,{id:r,topic:t}),n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(1),n.next=12,this.sendError(r,t,n.t0);case 12:this.logger.error(n.t0);case 13:case"end":return n.stop()}}),n,this,[[1,8]])})))},this.onUnknownRpcMethodRequest=function(t,e){return W(r,null,T().mark((function n(){var r,i,o;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=e.id,i=e.method,n.prev=1,!this.registeredMethods.includes(i)){n.next=4;break}return n.abrupt("return");case 4:return o=Object(h.G)("WC_METHOD_UNSUPPORTED",i),n.next=7,this.sendError(r,t,o);case 7:this.logger.error(o),n.next=15;break;case 10:return n.prev=10,n.t0=n.catch(1),n.next=14,this.sendError(r,t,n.t0);case 14:this.logger.error(n.t0);case 15:case"end":return n.stop()}}),n,this,[[1,10]])})))},this.onUnknownRpcMethodResponse=function(t){r.registeredMethods.includes(t)||r.logger.error(Object(h.G)("WC_METHOD_UNSUPPORTED",t))},this.isValidPair=function(t){var e;if(!Object(h.fb)(t)){var n=Object(h.A)("MISSING_OR_INVALID","pair() params: ".concat(t)).message;throw new Error(n)}if(!Object(h.nb)(t.uri)){var r=Object(h.A)("MISSING_OR_INVALID","pair() uri: ".concat(t.uri)).message;throw new Error(r)}var i=Object(h.tb)(t.uri);if(null==(e=null==i?void 0:i.relay)||!e.protocol){var o=Object(h.A)("MISSING_OR_INVALID","pair() uri#relay-protocol").message;throw new Error(o)}if(null==i||!i.symKey){var a=Object(h.A)("MISSING_OR_INVALID","pair() uri#symKey").message;throw new Error(a)}if(null!=i&&i.expiryTimestamp&&Object(f.toMiliseconds)(null==i?void 0:i.expiryTimestamp)"u"&&(n.response=Object(y.isJsonRpcError)(t)?{error:t.error}:{result:t.result},this.records.set(n.id,n),this.persist(),this.events.emit(Oe,n));case 6:case"end":return e.stop()}}),e,this)})))},i.get=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:t,id:e}),n.next=5,this.getRecord(e);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n,this)})))},i.delete=function(t,e){i.isInitialized(),i.logger.debug("Deleting record"),i.logger.trace({type:"method",method:"delete",id:e}),i.values.forEach((function(n){if(n.topic===t){if(k(e)<"u"&&n.id!==e)return;i.records.delete(n.id),i.events.emit(ze,n)}})),i.persist()},i.exists=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),!this.records.has(e)){n.next=9;break}return n.next=4,this.getRecord(e);case 4:n.t1=n.sent.topic,n.t2=t,n.t0=n.t1===n.t2,n.next=10;break;case 9:n.t0=!1;case 10:return n.abrupt("return",n.t0);case 11:case"end":return n.stop()}}),n,this)})))},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.logger=Object(s.a)(n,i.name),i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"size",get:function(){return this.records.size}},{key:"keys",get:function(){return Array.from(this.records.keys())}},{key:"values",get:function(){return Array.from(this.records.values())}},{key:"pending",get:function(){var t=[];return this.values.forEach((function(e){if(!(k(e.response)<"u")){var n={topic:e.topic,request:Object(y.formatJsonRpcRequest)(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(n)}})),t}},{key:"setJsonRpcRecords",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getJsonRpcRecords",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getRecord",value:function(t){this.isInitialized();var e=this.records.get(t);if(!e){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw new Error(n)}return e}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setJsonRpcRecords(this.values);case 2:this.events.emit("history_sync");case 3:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getJsonRpcRecords();case 3:if(!(k(e=t.sent)>"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.records.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",records:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"registerEventListeners",value:function(){var t=this;this.events.on(De,(function(e){var n=De;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,record:e})})),this.events.on(Oe,(function(e){var n=Oe;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,record:e})})),this.events.on(ze,(function(e){var n=ze;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,record:e})})),this.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){t.cleanup()}))}},{key:"cleanup",value:function(){var t=this;try{this.isInitialized();var e=!1;this.records.forEach((function(n){Object(f.toMiliseconds)(n.expiry||0)-Date.now()<=0&&(t.logger.info("Deleting expired history log: ".concat(n.id)),t.records.delete(n.id),t.events.emit(ze,n,!1),e=!0)})),e&&this.persist()}catch(e){this.logger.warn(e)}}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.e),wn=function(t){function e(t,n){var i;return S(this,e),(i=A(this,e,[t,n])).core=t,i.logger=n,i.expirations=new Map,i.events=new r.EventEmitter,i.name="expirer",i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=pe,i.init=function(){return W(N(i),null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=9;break}return this.logger.trace("Initialized"),t.next=5,this.restore();case 5:this.cached.forEach((function(t){return e.expirations.set(t.target,t)})),this.cached=[],this.registerEventListeners(),this.initialized=!0;case 9:case"end":return t.stop()}}),t,this)})))},i.has=function(t){try{var e=i.formatTarget(t);return k(i.getExpiration(e))<"u"}catch(t){return!1}},i.set=function(t,e){i.isInitialized();var n=i.formatTarget(t),r={target:n,expiry:e};i.expirations.set(n,r),i.checkExpiry(n,r),i.events.emit(Pe.created,{target:n,expiration:r})},i.get=function(t){i.isInitialized();var e=i.formatTarget(t);return i.getExpiration(e)},i.del=function(t){if(i.isInitialized(),i.has(t)){var e=i.formatTarget(t),n=i.getExpiration(e);i.expirations.delete(e),i.events.emit(Pe.deleted,{target:e,expiration:n})}},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.logger=Object(s.a)(n,i.name),i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.expirations.size}},{key:"keys",get:function(){return Array.from(this.expirations.keys())}},{key:"values",get:function(){return Array.from(this.expirations.values())}},{key:"formatTarget",value:function(t){if("string"==typeof t)return Object(h.r)(t);if("number"==typeof t)return Object(h.o)(t);var e=Object(h.A)("UNKNOWN_TYPE","Target type: ".concat(k(t))).message;throw new Error(e)}},{key:"setExpirations",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getExpirations",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setExpirations(this.values);case 2:this.events.emit(Pe.sync);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getExpirations();case 3:if(!(k(e=t.sent)>"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.expirations.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored expirations for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",expirations:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore expirations for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"getExpiration",value:function(t){var e=this.expirations.get(t);if(!e){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw this.logger.warn(n),new Error(n)}return e}},{key:"checkExpiry",value:function(t,e){var n=e.expiry;Object(f.toMiliseconds)(n)-Date.now()<=0&&this.expire(t,e)}},{key:"expire",value:function(t,e){this.expirations.delete(t),this.events.emit(Pe.expired,{target:t,expiration:e})}},{key:"checkExpirations",value:function(){var t=this;this.core.relayer.connected&&this.expirations.forEach((function(e,n){return t.checkExpiry(n,e)}))}},{key:"registerEventListeners",value:function(){var t=this;this.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){return t.checkExpirations()})),this.events.on(Pe.created,(function(e){var n=Pe.created;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,data:e}),t.persist()})),this.events.on(Pe.expired,(function(e){var n=Pe.expired;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,data:e}),t.persist()})),this.events.on(Pe.deleted,(function(e){var n=Pe.deleted;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,data:e}),t.persist()}))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.d),bn=function(e){function n(e,r){var i;return S(this,n),(i=A(this,n,[e,r])).projectId=e,i.logger=r,i.name=_e,i.initialized=!1,i.queue=[],i.verifyDisabled=!1,i.init=function(t){return W(N(i),null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.verifyDisabled&&!Object(h.Q)()&&Object(h.K)()){e.next=2;break}return e.abrupt("return");case 2:return n=this.getVerifyUrl(null==t?void 0:t.verifyUrl),this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n,e.prev=4,e.next=7,this.createIframe();case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(4),this.logger.info("Verify iframe failed to load: ".concat(this.verifyUrl)),this.logger.info(e.t0);case 12:if(this.initialized){e.next=22;break}return this.removeIframe(),this.verifyUrl=Re,e.prev=14,e.next=17,this.createIframe();case 17:e.next=22;break;case 19:e.prev=19,e.t1=e.catch(14),this.logger.info("Verify iframe failed to load: ".concat(this.verifyUrl)),this.logger.info(e.t1),this.verifyDisabled=!0;case 22:case"end":return e.stop()}}),e,this,[[4,9],[14,19]])})))},i.register=function(t){return W(N(i),null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.initialized){e.next=4;break}this.sendPost(t.attestationId),e.next=7;break;case 4:return this.addToQueue(t.attestationId),e.next=7,this.init();case 7:case"end":return e.stop()}}),e,this)})))},i.resolve=function(t){return W(N(i),null,T().mark((function e(){var n,r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isDevEnv){e.next=2;break}return e.abrupt("return","");case 2:return n=this.getVerifyUrl(null==t?void 0:t.verifyUrl),e.prev=3,e.next=6,this.fetchAttestation(t.attestationId,n);case 6:r=e.sent,e.next=16;break;case 9:return e.prev=9,e.t0=e.catch(3),this.logger.info("failed to resolve attestation: ".concat(t.attestationId," from url: ").concat(n)),this.logger.info(e.t0),e.next=15,this.fetchAttestation(t.attestationId,Re);case 15:r=e.sent;case 16:return e.abrupt("return",r);case 17:case"end":return e.stop()}}),e,this,[[3,9]])})))},i.fetchAttestation=function(t,e){return W(N(i),null,T().mark((function n(){var r,i;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.logger.info("resolving attestation: ".concat(t," from url: ").concat(e)),r=this.startAbortTimer(2*f.ONE_SECOND),n.next=4,fetch("".concat(e,"/attestation/").concat(t),{signal:this.abortController.signal});case 4:if(i=n.sent,clearTimeout(r),200!==i.status){n.next=12;break}return n.next=9,i.json();case 9:n.t0=n.sent,n.next=13;break;case 12:n.t0=void 0;case 13:return n.abrupt("return",n.t0);case 14:case"end":return n.stop()}}),n,this)})))},i.addToQueue=function(t){i.queue.push(t)},i.processQueue=function(){0!==i.queue.length&&(i.queue.forEach((function(t){return i.sendPost(t)})),i.queue=[])},i.sendPost=function(t){var e;try{if(!i.iframe)return;null==(e=i.iframe.contentWindow)||e.postMessage(t,"*"),i.logger.info("postMessage sent: ".concat(t," ").concat(i.verifyUrl))}catch(t){}},i.createIframe=function(){return W(N(i),null,T().mark((function t(){var e,n,r=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=function t(n){"verify_ready"===n.data&&(r.onInit(),window.removeEventListener("message",t),e())},t.next=3,Promise.race([new Promise((function(t){var i=document.getElementById(_e);if(i)return r.iframe=i,r.onInit(),t();window.addEventListener("message",n);var o=document.createElement("iframe");o.id=_e,o.src="".concat(r.verifyUrl,"/").concat(r.projectId),o.style.display="none",document.body.append(o),r.iframe=o,e=t})),new Promise((function(t,e){return setTimeout((function(){window.removeEventListener("message",n),e("verify iframe load timeout")}),Object(f.toMiliseconds)(f.FIVE_SECONDS))}))]);case 3:case"end":return t.stop()}}),t)})))},i.onInit=function(){i.initialized=!0,i.processQueue()},i.removeIframe=function(){i.iframe&&(i.iframe.remove(),i.iframe=void 0,i.initialized=!1)},i.getVerifyUrl=function(t){var e=t||Be;return Ue.includes(e)||(i.logger.info("verify url: ".concat(e,", not included in trusted list, assigning default: ").concat(Be)),e=Be),e},i.logger=Object(s.a)(r,i.name),i.verifyUrl=Be,i.abortController=new AbortController,i.isDevEnv=Object(h.N)()&&t.env.IS_VITEST,i}return E(n,e),C(n,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"startAbortTimer",value:function(t){var e=this;return this.abortController=new AbortController,setTimeout((function(){return e.abortController.abort()}),Object(f.toMiliseconds)(t))}}])}(u.l),Mn=function(t){function e(t,n){var r;return S(this,e),(r=A(this,e,[t,n])).projectId=t,r.logger=n,r.context="echo",r.registerDeviceToken=function(t){return W(N(r),null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.clientId,r=t.token,i=t.notificationType,o=t.enableEncrypted,a=void 0!==o&&o,s="".concat("https://echo.walletconnect.com","/").concat(this.projectId,"/clients"),e.next=3,b()(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:i,token:r,always_raw:a})});case 3:case"end":return e.stop()}}),e,this)})))},r.logger=Object(s.a)(n,r.context),r}return E(e,t),C(e)}(u.b),An=Object.defineProperty,Nn=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable,xn=function(t,e,n){return e in t?An(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},kn=function(t,e){for(var n in e||(e={}))In.call(e,n)&&xn(t,n,e[n]);if(Nn){var r,i=O(Nn(e));try{for(i.s();!(r=i.n()).done;)n=r.value,En.call(e,n)&&xn(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},Tn=function(t){function e(t){var n,i;S(this,e),(n=A(this,e,[t])).protocol="wc",n.version=2,n.name=fe,n.events=new r.EventEmitter,n.initialized=!1,n.on=function(t,e){return n.events.on(t,e)},n.once=function(t,e){return n.events.once(t,e)},n.off=function(t,e){return n.events.off(t,e)},n.removeListener=function(t,e){return n.events.removeListener(t,e)},n.projectId=null==t?void 0:t.projectId,n.relayUrl=(null==t?void 0:t.relayUrl)||be,n.customStoragePrefix=null!=t&&t.customStoragePrefix?":".concat(t.customStoragePrefix):"";var u=Object(s.c)({level:"string"==typeof(null==t?void 0:t.logger)&&t.logger?t.logger:"error"}),c=Object(s.b)({opts:u,maxSizeInBytes:null==t?void 0:t.maxLogBlobSizeInBytes,loggerOverride:null==t?void 0:t.logger}),l=c.logger,h=c.chunkLoggerController;return n.logChunkController=h,null!=(i=n.logChunkController)&&i.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=function(){return W(n,null,T().mark((function t(){var e,n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser,!t.t0){t.next=10;break}if(t.t1=null==(n=this.logChunkController),t.t1){t.next=10;break}return t.t2=n,t.next=7,this.crypto.getClientId();case 7:t.t3=t.sent,t.t4={clientId:t.t3},t.t2.downloadLogsBlobInBrowser.call(t.t2,t.t4);case 10:case"end":return t.stop()}}),t,this)})))}),n.logger=Object(s.a)(l,n.name),n.heartbeat=new a.HeartBeat,n.crypto=new Ye(n,n.logger,null==t?void 0:t.keychain),n.history=new vn(n,n.logger),n.expirer=new wn(n,n.logger),n.storage=null!=t&&t.storage?t.storage:new o.a(kn(kn({},ye),null==t?void 0:t.storageOptions)),n.relayer=new cn({core:n,logger:n.logger,relayUrl:n.relayUrl,projectId:n.projectId}),n.pairing=new gn(n,n.logger),n.verify=new bn(n.projectId||"",n.logger),n.echoClient=new Mn(n.projectId||"",n.logger),n}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"start",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=4;break}return t.next=4,this.initialize();case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getLogsBlob",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=(e=this.logChunkController)){t.next=4;break}t.t0=void 0,t.next=10;break;case 4:return t.t1=e,t.next=7,this.crypto.getClientId();case 7:t.t2=t.sent,t.t3={clientId:t.t2},t.t0=t.t1.logsToBlob.call(t.t1,t.t3);case 10:return t.abrupt("return",t.t0);case 11:case"end":return t.stop()}}),t,this)})))}},{key:"initialize",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.logger.trace("Initialized"),t.prev=1,t.next=4,this.crypto.init();case 4:return t.next=6,this.history.init();case 6:return t.next=8,this.expirer.init();case 8:return t.next=10,this.relayer.init();case 10:return t.next=12,this.heartbeat.init();case 12:return t.next=14,this.pairing.init();case 14:this.initialized=!0,this.logger.info("Core Initialization Success"),t.next=21;break;case 18:throw t.prev=18,t.t0=t.catch(1),this.logger.warn("Core Initialization Failure at epoch ".concat(Date.now()),t.t0),this.logger.error(t.t0.message),t.t0;case 21:case"end":return t.stop()}}),t,this,[[1,18]])})))}}],[{key:"init",value:function(t){return W(this,null,T().mark((function n(){var r,i;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=new e(t),n.next=3,r.initialize();case 3:return n.next=5,r.crypto.getClientId();case 5:return i=n.sent,n.next=8,r.storage.setItem("WALLETCONNECT_CLIENT_ID",i);case 8:return n.abrupt("return",r);case 9:case"end":return n.stop()}}),n)})))}}])}(u.a)}).call(this,n(33))},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string";if(!t[e]||r(t[e])!==n)throw new Error('Missing or invalid "'.concat(e,'" param'))}function o(t,e,n){return!!(n.length?function(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}(t,e.length):function(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}(t,e.length))&&function(t,e){var n=!0;return e.forEach((function(e){e in t||(n=!1)})),n}(t,e)}function a(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_",r=t.split(n);return r[r.length-1].trim().toLowerCase()===e.trim().toLowerCase()}n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return a}))},function(t,e,n){n.d(e,"a",(function(){return y})),n.d(e,"b",(function(){return I})),n.d(e,"c",(function(){return x})),n.d(e,"d",(function(){return A})),n.d(e,"e",(function(){return m})),n.d(e,"f",(function(){return g})),n.d(e,"g",(function(){return v})),n.d(e,"h",(function(){return w})),n.d(e,"i",(function(){return E})),n.d(e,"j",(function(){return b})),n.d(e,"k",(function(){return M})),n.d(e,"l",(function(){return N}));var r=n(22),i=n(6),o=n.n(i);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var n=0;ne in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,u=(t,e)=>{for(var n in e||(e={}))o.call(e,n)&&s(t,n,e[n]);if(i)for(var n of i(e))a.call(e,n)&&s(t,n,e[n]);return t};Object.defineProperty(e,"__esModule",{value:!0});var c=n(95),l=n(18);class h{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class d{constructor(t,e,n){if(this.name=t,this.prefix=e,void 0===e.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if("string"==typeof t){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(t){return p(this,t)}}class f{constructor(t){this.decoders=t}or(t){return p(this,t)}decode(t){const e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const p=(t,e)=>new f(u(u({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class y{constructor(t,e,n,r){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=r,this.encoder=new h(t,e,n),this.decoder=new d(t,e,r)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const m=({name:t,prefix:e,encode:n,decode:r})=>new y(t,e,n,r);e.Codec=y,e.baseX=({prefix:t,name:e,alphabet:n})=>{const{encode:r,decode:i}=c(n,e);return m({prefix:t,name:e,encode:r,decode:t=>l.coerce(i(t))})},e.from=m,e.or=p,e.rfc4648=({name:t,prefix:e,bitsPerChar:n,alphabet:r})=>m({prefix:e,name:t,encode:t=>((t,e,n)=>{const r="="===e[e.length-1],i=(1<n;)a-=n,o+=e[i&s>>a];if(a&&(o+=e[i&s<((t,e,n,r)=>{const i={};for(let t=0;t=8&&(s-=8,a[c++]=255&u>>s)}if(s>=n||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a})(e,r,n,t)})},function(t,e,n){const r=n(86);t.exports=a;const i=function(){function t(t){return void 0!==t&&t}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e){return t(self)||t(window)||t(this)||{}}}().console||{},o={mapHttpRequest:p,mapHttpResponse:p,wrapRequestSerializer:y,wrapResponseSerializer:y,wrapErrorSerializer:y,req:p,res:p,err:function(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)void 0===e[n]&&(e[n]=t[n]);return e}};function a(t){(t=t||{}).browser=t.browser||{};const e=t.browser.transmit;if(e&&"function"!=typeof e.send)throw Error("pino: transmit option must have a send function");const n=t.browser.write||i;t.browser.write&&(t.browser.asObject=!0);const r=t.serializers||{},o=function(t,e){return Array.isArray(t)?t.filter((function(t){return"!stdSerializers.err"!==t})):!0===t&&Object.keys(e)}(t.browser.serialize,r);let u=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(u=!1),"function"==typeof n&&(n.error=n.fatal=n.warn=n.info=n.debug=n.trace=n),!1===t.enabled&&(t.level="silent");const h=t.level||"info",p=Object.create(n);p.log||(p.log=m),Object.defineProperty(p,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(p,"level",{get:function(){return this._level},set:function(t){if("silent"!==t&&!this.levels.values[t])throw Error("unknown level "+t);this._level=t,s(y,p,"error","log"),s(y,p,"fatal","error"),s(y,p,"warn","error"),s(y,p,"info","log"),s(y,p,"debug","log"),s(y,p,"trace","log")}});const y={transmit:e,serialize:o,asObject:t.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:f(t)};return p.levels=a.levels,p.level=h,p.setMaxListeners=p.getMaxListeners=p.emit=p.addListener=p.on=p.prependListener=p.once=p.prependOnceListener=p.removeListener=p.removeAllListeners=p.listeners=p.listenerCount=p.eventNames=p.write=p.flush=m,p.serializers=r,p._serialize=o,p._stdErrSerialize=u,p.child=function(n,i){if(!n)throw new Error("missing bindings for child Pino");i=i||{},o&&n.serializers&&(i.serializers=n.serializers);const a=i.serializers;if(o&&a){var s=Object.assign({},r,a),u=!0===t.browser.serialize?Object.keys(s):o;delete n.serializers,c([n],u,s,this._stdErrSerialize)}function h(t){this._childLevel=1+(0|t._childLevel),this.error=l(t,n,"error"),this.fatal=l(t,n,"fatal"),this.warn=l(t,n,"warn"),this.info=l(t,n,"info"),this.debug=l(t,n,"debug"),this.trace=l(t,n,"trace"),s&&(this.serializers=s,this._serialize=u),e&&(this._logEvent=d([].concat(t._logEvent.bindings,n)))}return h.prototype=this,new h(this)},e&&(p._logEvent=d()),p}function s(t,e,n,r){const o=Object.getPrototypeOf(e);e[n]=e.levelVal>e.levels.values[n]?m:o[n]?o[n]:i[n]||i[r]||m,function(t,e,n){var r;(t.transmit||e[n]!==m)&&(e[n]=(r=e[n],function(){const o=t.timestamp(),s=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var d=0;d-1&&r in n&&(t[i][r]=n[r](t[i][r]))}function l(t,e,n){return function(){const r=new Array(1+arguments.length);r[0]=e;for(var i=1;ia,d=l>a;if(h&&(c=e-c),d&&(l=e-l),c>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:h,k1:c,k2neg:d,k2:l}}}},gs=dr,vs=function(t){return fs(D(D({},ms),function(t){return{hash:t,hmac:function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;iQs)throw new Error("Invalid public key input")}return e}return U(a,[{key:"equals",value:function(t){return this._bn.eq(t._bn)}},{key:"toBase58",value:function(){return ar.encode(this.toBytes())}},{key:"toJSON",value:function(){return this.toBase58()}},{key:"toBytes",value:function(){var t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}},{key:"toBuffer",value:function(){var t=this._bn.toArrayLike(It);if(t.length===Qs)return t;var e=It.alloc(32);return t.copy(e,32-t.length),e}},{key:e,get:function(){return"PublicKey(".concat(this.toString(),")")}},{key:"toString",value:function(){return this.toBase58()}}],[{key:"unique",value:function(){var t=new a(Ys);return Ys+=1,new a(t.toBuffer())}},{key:"createWithSeed",value:(i=_(O().mark((function t(e,n,r){var i,o;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=It.concat([e.toBuffer(),It.from(n),r.toBuffer()]),o=dr(i),t.abrupt("return",new a(o));case 3:case"end":return t.stop()}}),t)}))),function(t,e,n){return i.apply(this,arguments)})},{key:"createProgramAddressSync",value:function(t,e){var n=It.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");n=It.concat([n,_s(t)])})),n=It.concat([n,e.toBuffer(),It.from("ProgramDerivedAddress")]);var r=dr(n);if(Ds(r))throw new Error("Invalid seeds, address must fall off the curve");return new a(r)}},{key:"createProgramAddress",value:(r=_(O().mark((function t(e,n){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.createProgramAddressSync(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"findProgramAddressSync",value:function(t,e){for(var n,r=255;0!=r;){try{var i=t.concat(It.from([r]));n=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}},{key:"findProgramAddress",value:(n=_(O().mark((function t(e,n){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.findProgramAddressSync(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"isOnCurve",value:function(t){return Ds(new a(t).toBytes())}}]),a}(Bs,Symbol.toStringTag);Os=Ws,Ws.default=new Os("11111111111111111111111111111111"),Us.set(Ws,{kind:"struct",fields:[["_bn","u256"]]});var Fs=function(){function t(e){if(B(this,t),this._publicKey=void 0,this._secretKey=void 0,e){var n=_s(e);if(64!==e.length)throw new Error("bad secret key size");this._publicKey=n.slice(32,64),this._secretKey=n.slice(0,32)}else this._secretKey=_s(Ss()),this._publicKey=_s(Cs(this._secretKey))}return U(t,[{key:"publicKey",get:function(){return new Ws(this._publicKey)}},{key:"secretKey",get:function(){return It.concat([this._secretKey,this._publicKey],64)}}]),t}(),Vs=new Ws("BPFLoader1111111111111111111111111111111111"),Hs=1232,Gs=127,qs=64,Zs=function(t){Y(n,t);var e=X(n);function n(t){var r;return B(this,n),(r=e.call(this,"Signature ".concat(t," has expired: block height exceeded."))).signature=void 0,r.signature=t,r}return U(n)}(G(Error));Object.defineProperty(Zs.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var Js=function(t){Y(n,t);var e=X(n);function n(t,r){var i;return B(this,n),(i=e.call(this,"Transaction was not confirmed in ".concat(r.toFixed(2)," seconds. It is ")+"unknown if it succeeded or failed. Check signature "+"".concat(t," using the Solana Explorer or CLI tools."))).signature=void 0,i.signature=t,i}return U(n)}(G(Error));Object.defineProperty(Js.prototype,"name",{value:"TransactionExpiredTimeoutError"});var Xs=function(t){Y(n,t);var e=X(n);function n(t){var r;return B(this,n),(r=e.call(this,"Signature ".concat(t," has expired: the nonce is no longer valid."))).signature=void 0,r.signature=t,r}return U(n)}(G(Error));Object.defineProperty(Xs.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});var Ks=function(){function t(e,n){B(this,t),this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=n}return U(t,[{key:"keySegments",value:function(){var t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}},{key:"get",value:function(t){var e,n=st(this.keySegments());try{for(n.s();!(e=n.n()).done;){var r=e.value;if(t256)throw new Error("Account index overflow encountered during compilation");var e=new Map;this.keySegments().flat().forEach((function(t,n){e.set(t.toBase58(),n)}));var n=function(t){var n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((function(t){return{programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((function(t){return n(t.pubkey)})),data:t.data}}))}}]),t}(),$s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey";return Wi(32,t)},tu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature";return Wi(64,t)},eu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",e=Qi([Bi("length"),Bi("lengthPadding"),Wi(zi(Bi(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),i=e;return i.decode=function(t,e){return n(t,e).chars.toString()},i.encode=function(t,e,n){var i={chars:It.from(t,"utf8")};return r(i,e,n)},i.alloc=function(t){return Bi().span+Bi().span+It.from(t,"utf8").length},i};function nu(t,e){var n=function t(n){if(n.span>=0)return n.span;if("function"==typeof n.alloc)return n.alloc(e[n.property]);if("count"in n&&"elementLayout"in n){var r=e[n.property];if(Array.isArray(r))return r.length*t(n.elementLayout)}else if("fields"in n)return nu({layout:n},e[n.property]);return 0},r=0;return t.layout.fields.forEach((function(t){r+=n(t)})),r}function ru(t){for(var e=0,n=0;;){var r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function iu(t,e){for(var n=e;;){var r=127&n;if(0==(n>>=7)){t.push(r);break}r|=128,t.push(r)}}function ou(t,e){if(!t)throw new Error(e||"Assertion failed")}var au=function(){function t(e,n){B(this,t),this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=n}return U(t,[{key:"getMessageComponents",value:function(){var t=et(this.keyMetaMap.entries());ou(t.length<=256,"Max static account keys length exceeded");var e=t.filter((function(t){var e=tt(t,2)[1];return e.isSigner&&e.isWritable})),n=t.filter((function(t){var e=tt(t,2)[1];return e.isSigner&&!e.isWritable})),r=t.filter((function(t){var e=tt(t,2)[1];return!e.isSigner&&e.isWritable})),i=t.filter((function(t){var e=tt(t,2)[1];return!e.isSigner&&!e.isWritable})),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};return ou(e.length>0,"Expected at least one writable signer key"),ou(tt(e[0],1)[0]===this.payer.toBase58(),"Expected first writable signer key to be the fee payer"),[o,[].concat(et(e.map((function(t){var e=tt(t,1)[0];return new Ws(e)}))),et(n.map((function(t){var e=tt(t,1)[0];return new Ws(e)}))),et(r.map((function(t){var e=tt(t,1)[0];return new Ws(e)}))),et(i.map((function(t){var e=tt(t,1)[0];return new Ws(e)}))))]}},{key:"extractTableLookup",value:function(t){var e=tt(this.drainKeysFoundInLookupTable(t.state.addresses,(function(t){return!t.isSigner&&!t.isInvoked&&t.isWritable})),2),n=e[0],r=e[1],i=tt(this.drainKeysFoundInLookupTable(t.state.addresses,(function(t){return!t.isSigner&&!t.isInvoked&&!t.isWritable})),2),o=i[0],a=i[1];if(0!==n.length||0!==o.length)return[{accountKey:t.key,writableIndexes:n,readonlyIndexes:o},{writable:r,readonly:a}]}},{key:"drainKeysFoundInLookupTable",value:function(t,e){var n,r=this,i=new Array,o=new Array,a=st(this.keyMetaMap.entries());try{var s=function(){var a=tt(n.value,2),s=a[0],u=a[1];if(e(u)){var c=new Ws(s),l=t.findIndex((function(t){return t.equals(c)}));l>=0&&(ou(l<256,"Max lookup table index exceeded"),i.push(l),o.push(c),r.keyMetaMap.delete(s))}};for(a.s();!(n=a.n()).done;)s()}catch(t){a.e(t)}finally{a.f()}return[i,o]}}],[{key:"compile",value:function(e,n){var r=new Map,i=function(t){var e=t.toBase58(),n=r.get(e);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(e,n)),n},o=i(n);o.isSigner=!0,o.isWritable=!0;var a,s=st(e);try{for(s.s();!(a=s.n()).done;){var u=a.value;i(u.programId).isInvoked=!0;var c,l=st(u.keys);try{for(l.s();!(c=l.n()).done;){var h=c.value,d=i(h.pubkey);d.isSigner||(d.isSigner=h.isSigner),d.isWritable||(d.isWritable=h.isWritable)}}catch(t){l.e(t)}finally{l.f()}}}catch(t){s.e(t)}finally{s.f()}return new t(n,r)}}]),t}(),su=function(){function t(e){var n=this;B(this,t),this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map((function(t){return new Ws(t)})),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach((function(t){return n.indexToProgramIds.set(t.programIdIndex,n.accountKeys[t.programIdIndex])}))}return U(t,[{key:"version",get:function(){return"legacy"}},{key:"staticAccountKeys",get:function(){return this.accountKeys}},{key:"compiledInstructions",get:function(){return this.instructions.map((function(t){return{programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:ar.decode(t.data)}}))}},{key:"addressTableLookups",get:function(){return[]}},{key:"getAccountKeys",value:function(){return new Ks(this.staticAccountKeys)}},{key:"isAccountSigner",value:function(t){return t=this.header.numRequiredSignatures?t-e0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new Ks(this.staticAccountKeys,e)}},{key:"isAccountSigner",value:function(t){return t=n?t-n=this.header.numRequiredSignatures?t-e0?this.signatures[0].signature:null}},{key:"toJSON",value:function(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((function(t){return t.toJSON()})),signers:this.signatures.map((function(t){return t.publicKey.toJSON()}))}}},{key:"add",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(var r=0;r-1?(a[n].isWritable=a[n].isWritable||t.isWritable,a[n].isSigner=a[n].isSigner||t.isSigner):a.push(t)})),a.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));var s=a.findIndex((function(t){return t.pubkey.equals(n)}));if(s>-1){var u=tt(a.splice(s,1),1)[0];u.isSigner=!0,u.isWritable=!0,a.unshift(u)}else a.unshift({pubkey:n,isSigner:!0,isWritable:!0});var c,l=st(this.signatures);try{var h=function(){var t=c.value,e=a.findIndex((function(e){return e.pubkey.equals(t.publicKey)}));if(!(e>-1))throw new Error("unknown signer: ".concat(t.publicKey.toString()));a[e].isSigner||(a[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))};for(l.s();!(c=l.n()).done;)h()}catch(t){l.e(t)}finally{l.f()}var d=0,f=0,p=0,y=[],m=[];a.forEach((function(t){var e=t.pubkey,n=t.isSigner,r=t.isWritable;n?(y.push(e.toString()),d+=1,r||(f+=1)):(m.push(e.toString()),r||(p+=1))}));var g=y.concat(m),v=e.map((function(t){var e=t.data,n=t.programId;return{programIdIndex:g.indexOf(n.toString()),accounts:t.keys.map((function(t){return g.indexOf(t.pubkey.toString())})),data:ar.encode(e)}}));return v.forEach((function(t){ou(t.programIdIndex>=0),t.accounts.forEach((function(t){return ou(t>=0)}))})),new su({header:{numRequiredSignatures:d,numReadonlySignedAccounts:f,numReadonlyUnsignedAccounts:p},accountKeys:g,recentBlockhash:t,instructions:v})}},{key:"_compile",value:function(){var t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every((function(t,n){return e[n].equals(t.publicKey)}))||(this.signatures=e.map((function(t){return{signature:null,publicKey:t}}))),t}},{key:"serializeMessage",value:function(){return this._compile().serialize()}},{key:"getEstimatedFee",value:(e=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getFeeForMessage(this.compileMessage());case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"setSigners",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n1?r-1:0),o=1;o ").concat(Hs)),i}},{key:"keys",get:function(){return ou(1===this.instructions.length),this.instructions[0].keys.map((function(t){return t.pubkey}))}},{key:"programId",get:function(){return ou(1===this.instructions.length),this.instructions[0].programId}},{key:"data",get:function(){return ou(1===this.instructions.length),this.instructions[0].data}}],[{key:"from",value:function(e){for(var n=et(e),r=ru(n),i=[],o=0;o1&&void 0!==arguments[1]?arguments[1]:[],r=new t;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),n.forEach((function(t,n){var i={signature:t==ar.encode(hu)?null:ar.decode(t),publicKey:e.accountKeys[n]};r.signatures.push(i)})),e.instructions.forEach((function(t){var n=t.accounts.map((function(t){var n=e.accountKeys[t];return{pubkey:n,isSigner:r.signatures.some((function(t){return t.publicKey.toString()===n.toString()}))||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}}));r.instructions.push(new du({keys:n,programId:e.accountKeys[t.programIdIndex],data:ar.decode(t.data)}))})),r._message=e,r._json=r.toJSON(),r}}]),t}(),pu=function(){function t(e){B(this,t),this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}return U(t,[{key:"compileToLegacyMessage",value:function(){return su.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}},{key:"compileToV0Message",value:function(t){return uu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:t})}}],[{key:"decompile",value:function(e,n){var r=e.header,i=e.compiledInstructions,o=e.recentBlockhash,a=r.numRequiredSignatures,s=r.numReadonlySignedAccounts,u=r.numReadonlyUnsignedAccounts,c=a-s;ou(c>0,"Message header is invalid");var l=e.staticAccountKeys.length-a-u;ou(l>=0,"Message header is invalid");var h=e.getAccountKeys(n),d=h.get(0);if(void 0===d)throw new Error("Failed to decompile message because no account keys were found");var f,p=[],y=st(i);try{for(y.s();!(f=y.n()).done;){var m,g=f.value,v=[],w=st(g.accountKeyIndexes);try{for(w.s();!(m=w.n()).done;){var b,M=m.value,A=h.get(M);if(void 0===A)throw new Error("Failed to find key for account key index ".concat(M));b=M=0,"Cannot sign with non signer key ".concat(t.publicKey.toBase58())),n.signatures[o]=zs(r,t.secretKey)};for(o.s();!(e=o.n()).done;)a()}catch(t){o.e(t)}finally{o.f()}}},{key:"addSignature",value:function(t,e){ou(64===e.byteLength,"Signature must be 64 bytes long");var n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((function(e){return e.equals(t)}));ou(n>=0,"Can not add signature; `".concat(t.toBase58(),"` is not required to sign this transaction")),this.signatures[n]=e}}],[{key:"deserialize",value:function(e){for(var n=et(e),r=[],i=ru(n),o=0;o=0?t.layout.span:nu(t,e),r=It.alloc(n),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,r),r}function Lu(t,e){var n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error("invalid instruction; instruction index mismatch ".concat(n.instruction," != ").concat(t.index));return n}var Su=Ri("lamportsPerSignature"),ju=Qi([Bi("version"),Bi("state"),$s("authorizedPubkey"),$s("nonce"),Qi([Su],"feeCalculator")]),Cu=ju.span,Du=function(){function t(e){B(this,t),this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}return U(t,null,[{key:"fromAccountData",value:function(e){var n=ju.decode(_s(e),0);return new t({authorizedPubkey:new Ws(n.authorizedPubkey),nonce:new Ws(n.nonce).toString(),feeCalculator:n.feeCalculator})}}]),t}(),Ou=function(t){var e=Wi(8,t),n=function(t){return{decode:t.decode.bind(t),encode:t.encode.bind(t)}}(e),r=n.encode,i=n.decode,o=e;return o.decode=function(t,e){var n=i(t,e);return Vi(It.from(n))},o.encode=function(t,e,n){var i=Hi(t,8);return r(i,e,n)},o},zu=function(){function t(){B(this,t)}return U(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=Bi("instruction").decode(t.data),r=0,i=Object.entries(Pu);r0?s:1,space:a.length,programId:o}));case 17:if(null===c){e.next=20;break}return e.next=20,Eu(n,c,[r,i],{commitment:"confirmed"});case 20:l=Qi([Bi("instruction"),Bi("offset"),Bi("bytesLength"),Bi("bytesLengthPadding"),Yi(Pi("byte"),zi(Bi(),-8),"bytes")]),h=t.chunkSize,d=0,f=a,p=[];case 25:if(!(f.length>0)){e.next=39;break}if(y=f.slice(0,h),m=It.alloc(h+16),l.encode({instruction:0,offset:d,bytes:y,bytesLength:0,bytesLengthPadding:0},m),g=(new fu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:m}),p.push(Eu(n,g,[r,i],{commitment:"confirmed"})),!n._rpcEndpoint.includes("solana.com")){e.next=35;break}return e.next=35,ku(250);case 35:d+=h,f=f.slice(h),e.next=25;break;case 39:return e.next=41,Promise.all(p);case 41:return v=Qi([Bi("instruction")]),w=It.alloc(v.span),v.encode({instruction:1},w),b=(new fu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0},{pubkey:bu,isSigner:!1,isWritable:!1}],programId:o,data:w}),M="processed",e.next=48,n.sendTransaction(b,[r,i],{preflightCommitment:M});case 48:return A=e.sent,e.next=51,n.confirmTransaction({signature:A,lastValidBlockHeight:b.lastValidBlockHeight,blockhash:b.recentBlockhash},M);case 51:if(N=e.sent,I=N.context,!(E=N.value).err){e.next=56;break}throw new Error("Transaction ".concat(A," failed (").concat(JSON.stringify(E),")"));case 56:return e.prev=57,e.next=60,n.getSlot({commitment:M});case 60:if(!(e.sent>I.slot)){e.next=63;break}return e.abrupt("break",71);case 63:e.next=67;break;case 65:e.prev=65,e.t0=e.catch(57);case 67:return e.next=69,new Promise((function(t){return setTimeout(t,Math.round(200))}));case 69:e.next=56;break;case 71:return e.abrupt("return",!0);case 72:case"end":return e.stop()}}),e,null,[[57,65]])}))),function(t,n,r,i,o){return e.apply(this,arguments)})}]),t}();Bu.chunkSize=932;var Ru=new Ws("BPFLoader2111111111111111111111111111111111"),Uu=function(){function t(){B(this,t)}return U(t,null,[{key:"getMinNumSignatures",value:function(t){return Bu.getMinNumSignatures(t)}},{key:"load",value:function(t,e,n,r,i){return Bu.load(t,e,n,i,r)}}]),t}(),Qu=Object.prototype.toString,Yu=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function Wu(t,e){var n,r,i,o,a,s,u;if(!0===t)return"true";if(!1===t)return"false";switch(z(t)){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return Wu(t.toJSON(),e);if("[object Array]"===(u=Qu.call(t))){for(i="[",r=t.length-1,n=0;n-1&&(i+=Wu(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=Yu(t).sort()).length,i="",n=0;n1;)t/=2,e++;return e}var Hu=function(){function t(e,n,r,i,o){B(this,t),this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=n,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=o}return U(t,[{key:"getEpoch",value:function(t){return this.getEpochAndSlotIndex(t)[0]}},{key:"getEpochAndSlotIndex",value:function(t){if(t>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32))}(t+32+1))-Vu(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}var n=t-this.firstNormalSlot,r=Math.floor(n/this.slotsPerEpoch);return[this.firstNormalEpoch+r,n%this.slotsPerEpoch]}},{key:"getFirstSlotInEpoch",value:function(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}},{key:"getLastSlotInEpoch",value:function(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}},{key:"getSlotsInEpoch",value:function(t){return t0&&(i.until=a.signatures[a.signatures.length-1].toString()),t.next=22;break;case 15:if(t.prev=15,t.t0=t.catch(8),!(t.t0 instanceof Error&&t.t0.message.includes("skipped"))){t.next=21;break}return t.abrupt("continue",4);case 21:throw t.t0;case 22:t.next=4;break;case 24:return t.next=26,this.getSlot("finalized");case 26:s=t.sent;case 27:if("before"in i){t.next=47;break}if(!(++r>s)){t.next=31;break}return t.abrupt("break",47);case 31:return t.prev=31,t.next=34,this.getConfirmedBlockSignatures(r);case 34:(u=t.sent).signatures.length>0&&(i.before=u.signatures[u.signatures.length-1].toString()),t.next=45;break;case 38:if(t.prev=38,t.t1=t.catch(31),!(t.t1 instanceof Error&&t.t1.message.includes("skipped"))){t.next=44;break}return t.abrupt("continue",27);case 44:throw t.t1;case 45:t.next=27;break;case 47:return t.next=49,this.getConfirmedSignaturesForAddress2(e,i);case 49:return c=t.sent,t.abrupt("return",c.map((function(t){return t.signature})));case 51:case"end":return t.stop()}}),t,this,[[8,15],[31,38]])}))),function(t,e,n){return N.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress2",value:(A=_(O().mark((function t(e,n,r){var i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,n),t.next=3,this._rpcRequest("getConfirmedSignaturesForAddress2",i);case 3:if(o=t.sent,!("error"in(a=ao(o,Wc)))){t.next=7;break}throw new qu(a.error,"failed to get confirmed signatures for address");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return A.apply(this,arguments)})},{key:"getSignaturesForAddress",value:(M=_(O().mark((function t(e,n,r){var i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,n),t.next=3,this._rpcRequest("getSignaturesForAddress",i);case 3:if(o=t.sent,!("error"in(a=ao(o,Fc)))){t.next=7;break}throw new qu(a.error,"failed to get signatures for address");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return M.apply(this,arguments)})},{key:"getAddressLookupTable",value:(b=_(O().mark((function t(e,n){var r,i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAccountInfoAndContext(e,n);case 2:return r=t.sent,i=r.context,o=r.value,a=null,null!==o&&(a=new Xu({key:e,state:Xu.deserialize(o.data)})),t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return b.apply(this,arguments)})},{key:"getNonceAndContext",value:(w=_(O().mark((function t(e,n){var r,i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAccountInfoAndContext(e,n);case 2:return r=t.sent,i=r.context,o=r.value,a=null,null!==o&&(a=Du.fromAccountData(o.data)),t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return w.apply(this,arguments)})},{key:"getNonce",value:(v=_(O().mark((function t(e,n){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getNonceAndContext(e,n).then((function(t){return t.value})).catch((function(t){throw new Error("failed to get nonce for account "+e.toBase58()+": "+t)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return v.apply(this,arguments)})},{key:"requestAirdrop",value:(g=_(O().mark((function t(e,n){var r,i;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("requestAirdrop",[e.toBase58(),n]);case 2:if(r=t.sent,!("error"in(i=ao(r,Pl)))){t.next=6;break}throw new qu(i.error,"airdrop to ".concat(e.toBase58()," failed"));case 6:return t.abrupt("return",i.result);case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return g.apply(this,arguments)})},{key:"_blockhashWithExpiryBlockHeight",value:(m=_(O().mark((function t(e){var n,r;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=10;break}case 1:if(!this._pollingBlockhash){t.next=6;break}return t.next=4,ku(100);case 4:t.next=1;break;case 6:if(n=Date.now()-this._blockhashInfo.lastFetch,r=n>=3e4,null===this._blockhashInfo.latestBlockhash||r){t.next=10;break}return t.abrupt("return",this._blockhashInfo.latestBlockhash);case 10:return t.next=12,this._pollNewBlockhash();case 12:return t.abrupt("return",t.sent);case 13:case"end":return t.stop()}}),t,this)}))),function(t){return m.apply(this,arguments)})},{key:"_pollNewBlockhash",value:(y=_(O().mark((function t(){var e,n,r,i,o;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._pollingBlockhash=!0,t.prev=1,e=Date.now(),n=this._blockhashInfo.latestBlockhash,r=n?n.blockhash:null,i=0;case 6:if(!(i<50)){t.next=18;break}return t.next=9,this.getLatestBlockhash("finalized");case 9:if(o=t.sent,r===o.blockhash){t.next=13;break}return this._blockhashInfo={latestBlockhash:o,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t.abrupt("return",o);case 13:return t.next=15,ku(200);case 15:i++,t.next=6;break;case 18:throw new Error("Unable to obtain a new blockhash after ".concat(Date.now()-e,"ms"));case 19:return t.prev=19,this._pollingBlockhash=!1,t.finish(19);case 22:case"end":return t.stop()}}),t,this,[[1,,19,22]])}))),function(){return y.apply(this,arguments)})},{key:"getStakeMinimumDelegation",value:(p=_(O().mark((function t(e){var n,r,i,o,a,s;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=rc(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,"base64",i),t.next=4,this._rpcRequest("getStakeMinimumDelegation",o);case 4:if(a=t.sent,!("error"in(s=ao(a,sc(mo()))))){t.next=8;break}throw new qu(s.error,"failed to get stake minimum delegation");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return p.apply(this,arguments)})},{key:"simulateTransaction",value:(f=_(O().mark((function t(e,n,r){var i,o,a,s,u,c,l,h,d,f,p,y,m,g,v,w,b,M,A,N,I,E,x,k,T;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("message"in e)){t.next=17;break}if(i=e.serialize(),o=It.from(i).toString("base64"),!Array.isArray(n)&&void 0===r){t.next=6;break}throw new Error("Invalid arguments");case 6:return(a=n||{}).encoding="base64","commitment"in a||(a.commitment=this.commitment),s=[o,a],t.next=12,this._rpcRequest("simulateTransaction",s);case 12:if(u=t.sent,!("error"in(c=ao(u,Mc)))){t.next=16;break}throw new Error("failed to simulate transaction: "+c.error.message);case 16:return t.abrupt("return",c.result);case 17:if(e instanceof fu?(h=e,(l=new fu).feePayer=h.feePayer,l.instructions=e.instructions,l.nonceInfo=h.nonceInfo,l.signatures=h.signatures):(l=fu.populate(e))._message=l._json=void 0,void 0===n||Array.isArray(n)){t.next=20;break}throw new Error("Invalid arguments");case 20:if(d=n,!l.nonceInfo||!d){t.next=25;break}(f=l).sign.apply(f,et(d)),t.next=45;break;case 25:p=this._disableBlockhashCaching;case 26:return t.next=28,this._blockhashWithExpiryBlockHeight(p);case 28:if(m=t.sent,l.lastValidBlockHeight=m.lastValidBlockHeight,l.recentBlockhash=m.blockhash,d){t.next=33;break}return t.abrupt("break",45);case 33:if((y=l).sign.apply(y,et(d)),l.signature){t.next=36;break}throw new Error("!signature");case 36:if(g=l.signature.toString("base64"),this._blockhashInfo.simulatedSignatures.includes(g)||this._blockhashInfo.transactionSignatures.includes(g)){t.next=42;break}return this._blockhashInfo.simulatedSignatures.push(g),t.abrupt("break",45);case 42:p=!0;case 43:t.next=26;break;case 45:return v=l._compile(),w=v.serialize(),b=l._serialize(w),M=b.toString("base64"),A={encoding:"base64",commitment:this.commitment},r&&(N=(Array.isArray(r)?r:v.nonProgramIds()).map((function(t){return t.toBase58()})),A.accounts={encoding:"base64",addresses:N}),d&&(A.sigVerify=!0),I=[M,A],t.next=55,this._rpcRequest("simulateTransaction",I);case 55:if(E=t.sent,!("error"in(x=ao(E,Mc)))){t.next=60;break}throw"data"in x.error&&(k=x.error.data.logs)&&Array.isArray(k)&&(T="\n "+k.join("\n "),console.error(x.error.message,T)),new Gu("failed to simulate transaction: "+x.error.message,k);case 60:return t.abrupt("return",x.result);case 61:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return f.apply(this,arguments)})},{key:"sendTransaction",value:(d=_(O().mark((function t(e,n,r){var i,o,a,s,u,c;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("version"in e)){t.next=7;break}if(!n||!Array.isArray(n)){t.next=3;break}throw new Error("Invalid arguments");case 3:return i=e.serialize(),t.next=6,this.sendRawTransaction(i,n);case 6:return t.abrupt("return",t.sent);case 7:if(void 0!==n&&Array.isArray(n)){t.next=9;break}throw new Error("Invalid arguments");case 9:if(o=n,!e.nonceInfo){t.next=14;break}e.sign.apply(e,et(o)),t.next=32;break;case 14:a=this._disableBlockhashCaching;case 15:return t.next=17,this._blockhashWithExpiryBlockHeight(a);case 17:if(s=t.sent,e.lastValidBlockHeight=s.lastValidBlockHeight,e.recentBlockhash=s.blockhash,e.sign.apply(e,et(o)),e.signature){t.next=23;break}throw new Error("!signature");case 23:if(u=e.signature.toString("base64"),this._blockhashInfo.transactionSignatures.includes(u)){t.next=29;break}return this._blockhashInfo.transactionSignatures.push(u),t.abrupt("break",32);case 29:a=!0;case 30:t.next=15;break;case 32:return c=e.serialize(),t.next=35,this.sendRawTransaction(c,r);case 35:return t.abrupt("return",t.sent);case 36:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return d.apply(this,arguments)})},{key:"sendRawTransaction",value:(h=_(O().mark((function t(e,n){var r,i;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_s(e).toString("base64"),t.next=3,this.sendEncodedTransaction(r,n);case 3:return i=t.sent,t.abrupt("return",i);case 5:case"end":return t.stop()}}),t,this)}))),function(t,e){return h.apply(this,arguments)})},{key:"sendEncodedTransaction",value:(l=_(O().mark((function t(e,n){var r,i,o,a,s,u,c;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={encoding:"base64"},i=n&&n.skipPreflight,o=n&&n.preflightCommitment||this.commitment,n&&null!=n.maxRetries&&(r.maxRetries=n.maxRetries),n&&null!=n.minContextSlot&&(r.minContextSlot=n.minContextSlot),i&&(r.skipPreflight=i),o&&(r.preflightCommitment=o),a=[e,r],t.next=10,this._rpcRequest("sendTransaction",a);case 10:if(s=t.sent,!("error"in(u=ao(s,_l)))){t.next=15;break}throw"data"in u.error&&(c=u.error.data.logs),new Gu("failed to send transaction: "+u.error.message,c);case 15:return t.abrupt("return",u.result);case 16:case"end":return t.stop()}}),t,this)}))),function(t,e){return l.apply(this,arguments)})},{key:"_wsOnOpen",value:function(){var t=this;this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((function(){_(O().mark((function e(){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t._rpcWebSocket.notify("ping");case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})))()}),5e3),this._updateSubscriptions()}},{key:"_wsOnError",value:function(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}},{key:"_wsOnClose",value:function(t){var e=this;this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((function(t){var n=tt(t,2),r=n[0],i=n[1];e._setSubscription(r,D(D({},i),{},{state:"pending"}))}))):this._updateSubscriptions()}},{key:"_setSubscription",value:function(t,e){var n,r=null===(n=this._subscriptionsByHash[t])||void 0===n?void 0:n.state;if(this._subscriptionsByHash[t]=e,r!==e.state){var i=this._subscriptionStateChangeCallbacksByHash[t];i&&i.forEach((function(t){try{t(e.state)}catch(t){}}))}}},{key:"_onSubscriptionStateChange",value:function(t,e){var n,r=this,i=this._subscriptionHashByClientSubscriptionId[t];if(null==i)return function(){};var o=(n=this._subscriptionStateChangeCallbacksByHash)[i]||(n[i]=new Set);return o.add(e),function(){o.delete(e),0===o.size&&delete r._subscriptionStateChangeCallbacksByHash[i]}}},{key:"_updateSubscriptions",value:(c=_(O().mark((function t(){var e,n,r=this;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==Object.keys(this._subscriptionsByHash).length){t.next=3;break}return this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((function(){r._rpcWebSocketIdleTimeout=null;try{r._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log("Error when closing socket connection: ".concat(t.message))}}),500)),t.abrupt("return");case 3:if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),this._rpcWebSocketConnected){t.next=7;break}return this._rpcWebSocket.connect(),t.abrupt("return");case 7:return e=this._rpcWebSocketGeneration,n=function(){return e===r._rpcWebSocketGeneration},t.next=11,Promise.all(Object.keys(this._subscriptionsByHash).map(function(){var t=_(O().mark((function t(e){var i;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(i=r._subscriptionsByHash[e])){t.next=3;break}return t.abrupt("return");case 3:t.t0=i.state,t.next="pending"===t.t0||"unsubscribed"===t.t0?6:"subscribed"===t.t0?15:19;break;case 6:if(0!==i.callbacks.size){t.next=12;break}return delete r._subscriptionsByHash[e],"unsubscribed"===i.state&&delete r._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],t.next=11,r._updateSubscriptions();case 11:return t.abrupt("return");case 12:return t.next=14,_(O().mark((function t(){var o,a,s;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=i.args,a=i.method,t.prev=1,r._setSubscription(e,D(D({},i),{},{state:"subscribing"})),t.next=5,r._rpcWebSocket.call(a,o);case 5:return s=t.sent,r._setSubscription(e,D(D({},i),{},{serverSubscriptionId:s,state:"subscribed"})),r._subscriptionCallbacksByServerSubscriptionId[s]=i.callbacks,t.next=10,r._updateSubscriptions();case 10:t.next=20;break;case 12:if(t.prev=12,t.t0=t.catch(1),t.t0 instanceof Error&&console.error("".concat(a," error for argument"),o,t.t0.message),n()){t.next=17;break}return t.abrupt("return");case 17:return r._setSubscription(e,D(D({},i),{},{state:"pending"})),t.next=20,r._updateSubscriptions();case 20:case"end":return t.stop()}}),t,null,[[1,12]])})))();case 14:case 18:return t.abrupt("break",19);case 15:if(0!==i.callbacks.size){t.next=18;break}return t.next=18,_(O().mark((function t(){var o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=i.serverSubscriptionId,a=i.unsubscribeMethod,!r._subscriptionsAutoDisposedByRpc.has(o)){t.next=5;break}r._subscriptionsAutoDisposedByRpc.delete(o),t.next=21;break;case 5:return r._setSubscription(e,D(D({},i),{},{state:"unsubscribing"})),r._setSubscription(e,D(D({},i),{},{state:"unsubscribing"})),t.prev=7,t.next=10,r._rpcWebSocket.call(a,[o]);case 10:t.next=21;break;case 12:if(t.prev=12,t.t0=t.catch(7),t.t0 instanceof Error&&console.error("".concat(a," error:"),t.t0.message),n()){t.next=17;break}return t.abrupt("return");case 17:return r._setSubscription(e,D(D({},i),{},{state:"subscribed"})),t.next=20,r._updateSubscriptions();case 20:return t.abrupt("return");case 21:return r._setSubscription(e,D(D({},i),{},{state:"unsubscribed"})),t.next=24,r._updateSubscriptions();case 24:case"end":return t.stop()}}),t,null,[[7,12]])})))();case 19:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 11:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"_handleServerNotification",value:function(t,e){var n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((function(t){try{t.apply(void 0,et(e))}catch(t){console.error(t)}}))}},{key:"_wsOnAccountNotification",value:function(t){var e=ao(t,Vc),n=e.result,r=e.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_makeSubscription",value:function(t,e){var n=this,r=this._nextClientSubscriptionId++,i=Fu([t.method,e],!0),o=this._subscriptionsByHash[i];return void 0===o?this._subscriptionsByHash[i]=D(D({},t),{},{args:e,callbacks:new Set([t.callback]),state:"pending"}):o.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=_(O().mark((function e(){var o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return delete n._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete n._subscriptionHashByClientSubscriptionId[r],ou(void 0!==(o=n._subscriptionsByHash[i]),"Could not find a `Subscription` when tearing down client subscription #".concat(r)),o.callbacks.delete(t.callback),e.next=7,n._updateSubscriptions();case 7:case"end":return e.stop()}}),e)}))),this._updateSubscriptions(),r}},{key:"onAccountChange",value:function(t,e,n){var r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}},{key:"removeAccountChangeListener",value:(u=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"account change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"_wsOnProgramAccountNotification",value:function(t){var e=ao(t,Gc),n=e.result,r=e.subscription;this._handleServerNotification(r,[{accountId:n.value.pubkey,accountInfo:n.value.account},n.context])}},{key:"onProgramAccountChange",value:function(t,e,n,r){var i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}},{key:"removeProgramAccountChangeListener",value:(s=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"program account change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"onLogs",value:function(t,e,n){var r=this._buildArgs(["object"===z(t)?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}},{key:"removeOnLogsListener",value:(a=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"logs");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"_wsOnLogsNotification",value:function(t){var e=ao(t,Rl),n=e.result,r=e.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_wsOnSlotNotification",value:function(t){var e=ao(t,Zc),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotChange",value:function(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}},{key:"removeSlotChangeListener",value:(o=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"slot change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"_wsOnSlotUpdatesNotification",value:function(t){var e=ao(t,Xc),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotUpdate",value:function(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}},{key:"removeSlotUpdateListener",value:(i=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"slot update");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"_unsubscribeClientSubscription",value:(r=_(O().mark((function t(e,n){var r;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r=this._subscriptionDisposeFunctionsByClientSubscriptionId[e])){t.next=6;break}return t.next=4,r();case 4:t.next=7;break;case 6:console.warn("Ignored unsubscribe request because an active subscription with id "+"`".concat(e,"` for '").concat(n,"' events ")+"could not be found.");case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"_buildArgs",value:function(t,e,n,r){var i=e||this._commitment;if(i||n||r){var o={};n&&(o.encoding=n),i&&(o.commitment=i),r&&(o=Object.assign(o,r)),t.push(o)}return t}},{key:"_buildArgsAtLeastConfirmed",value:function(t,e,n,r){var i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}},{key:"_wsOnSignatureNotification",value:function(t){var e=ao(t,Kc),n=e.result,r=e.subscription;"receivedSignature"!==n.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===n.value?[{type:"received"},n.context]:[{type:"status",result:n.value},n.context])}},{key:"onSignature",value:function(t,e,n){var r=this,i=this._buildArgs([t],n||this._commitment||"finalized"),o=this._makeSubscription({callback:function(t,n){if("status"===t.type){e(t.result,n);try{r.removeSignatureListener(o)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return o}},{key:"onSignatureWithOptions",value:function(t,e,n){var r=this,i=D(D({},n),{},{commitment:n&&n.commitment||this._commitment||"finalized"}),o=i.commitment,a=q(i,Ls),s=this._buildArgs([t],o,void 0,a),u=this._makeSubscription({callback:function(t,n){e(t,n);try{r.removeSignatureListener(u)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return u}},{key:"removeSignatureListener",value:(n=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"signature result");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"_wsOnRootNotification",value:function(t){var e=ao(t,$c),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onRootChange",value:function(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}},{key:"removeRootChangeListener",value:(e=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"root change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),t}(),Yl=function(){function t(e){B(this,t),this._keypair=void 0,this._keypair=null!=e?e:js()}return U(t,[{key:"publicKey",get:function(){return new Ws(this._keypair.publicKey)}},{key:"secretKey",get:function(){return new Uint8Array(this._keypair.secretKey)}}],[{key:"generate",value:function(){return new t(js())}},{key:"fromSecretKey",value:function(e,n){if(64!==e.byteLength)throw new Error("bad secret key size");var r=e.slice(32,64);if(!n||!n.skipValidation)for(var i=e.slice(0,32),o=Cs(i),a=0;a<32;a++)if(r[a]!==o[a])throw new Error("provided secretKey is invalid");return new t({publicKey:r,secretKey:e})}},{key:"fromSeed",value:function(e){var n=Cs(e),r=new Uint8Array(64);return r.set(e),r.set(n,32),new t({publicKey:n,secretKey:r})}}]),t}(),Wl=Object.freeze({CreateLookupTable:{index:0,layout:Qi([Bi("instruction"),Ou("recentSlot"),Pi("bumpSeed")])},FreezeLookupTable:{index:1,layout:Qi([Bi("instruction")])},ExtendLookupTable:{index:2,layout:Qi([Bi("instruction"),Ou(),Yi($s(),zi(Bi(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Qi([Bi("instruction")])},CloseLookupTable:{index:4,layout:Qi([Bi("instruction")])}}),Fl=function(){function t(){B(this,t)}return U(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=Bi("instruction").decode(t.data),r=0,i=Object.entries(Wl);r2?t.keys[2].pubkey:void 0,addresses:e.map((function(t){return new Ws(t)}))}}},{key:"decodeCloseLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}},{key:"decodeFreezeLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}},{key:"decodeDeactivateLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(Vl.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}},{key:"checkKeysLength",value:function(t,e){if(t.length3&&(i.custodianPubkey=t.keys[3].pubkey),i}},{key:"decodeAuthorizeWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=Lu(oh.AuthorizeWithSeed,t.data),n=e.newAuthorized,r=e.stakeAuthorizationType,i=e.authoritySeed,o=e.authorityOwner,a={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:i,authorityOwner:new Ws(o),newAuthorizedPubkey:new Ws(n),stakeAuthorizationType:{index:r}};return t.keys.length>3&&(a.custodianPubkey=t.keys[3].pubkey),a}},{key:"decodeSplit",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=Lu(oh.Split,t.data).lamports;return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}},{key:"decodeMerge",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Lu(oh.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}},{key:"decodeWithdraw",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);var e=Lu(oh.Withdraw,t.data).lamports,n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}},{key:"decodeDeactivate",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Lu(oh.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(sh.programId))throw new Error("invalid instruction; programId is not StakeProgram")}},{key:"checkKeyLength",value:function(t,e){if(t.length0&&void 0!==arguments[0]?arguments[0]:"authorized";return Qi([$s("staker"),$s("withdrawer")],t)}(),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return Qi([Ui("unixTimestamp"),Ui("epoch"),$s("custodian")],t)}()])},Authorize:{index:1,layout:Qi([Bi("instruction"),$s("newAuthorized"),Bi("stakeAuthorizationType")])},Delegate:{index:2,layout:Qi([Bi("instruction")])},Split:{index:3,layout:Qi([Bi("instruction"),Ui("lamports")])},Withdraw:{index:4,layout:Qi([Bi("instruction"),Ui("lamports")])},Deactivate:{index:5,layout:Qi([Bi("instruction")])},Merge:{index:7,layout:Qi([Bi("instruction")])},AuthorizeWithSeed:{index:8,layout:Qi([Bi("instruction"),$s("newAuthorized"),Bi("stakeAuthorizationType"),eu("authoritySeed"),$s("authorityOwner")])}}),ah=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),sh=function(){function t(){B(this,t)}return U(t,null,[{key:"initialize",value:function(t){var e=t.stakePubkey,n=t.authorized,r=t.lockup||rh.default,i=Tu(oh.Initialize,{authorized:{staker:_s(n.staker.toBuffer()),withdrawer:_s(n.withdrawer.toBuffer())},lockup:{unixTimestamp:r.unixTimestamp,epoch:r.epoch,custodian:_s(r.custodian.toBuffer())}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:bu,isSigner:!1,isWritable:!1}],programId:this.programId,data:i};return new du(o)}},{key:"createAccountWithSeed",value:function(t){var e=new fu;e.add(_u.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));var n=t.stakePubkey,r=t.authorized,i=t.lockup;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"createAccount",value:function(t){var e=new fu;e.add(_u.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));var n=t.stakePubkey,r=t.authorized,i=t.lockup;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"delegate",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.votePubkey,i=Tu(oh.Delegate);return(new fu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:Iu,isSigner:!1,isWritable:!1},{pubkey:eh,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"authorize",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.newAuthorizedPubkey,i=t.stakeAuthorizationType,o=t.custodianPubkey,a=Tu(oh.Authorize,{newAuthorized:_s(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:mu,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new fu).add({keys:s,programId:this.programId,data:a})}},{key:"authorizeWithSeed",value:function(t){var e=t.stakePubkey,n=t.authorityBase,r=t.authoritySeed,i=t.authorityOwner,o=t.newAuthorizedPubkey,a=t.stakeAuthorizationType,s=t.custodianPubkey,u=Tu(oh.AuthorizeWithSeed,{newAuthorized:_s(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:_s(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:mu,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new fu).add({keys:c,programId:this.programId,data:u})}},{key:"splitInstruction",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.splitStakePubkey,i=t.lamports,o=Tu(oh.Split,{lamports:i});return new du({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}},{key:"split",value:function(t){var e=new fu;return e.add(_u.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}},{key:"splitWithSeed",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.splitStakePubkey,i=t.basePubkey,o=t.seed,a=t.lamports,s=new fu;return s.add(_u.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}},{key:"merge",value:function(t){var e=t.stakePubkey,n=t.sourceStakePubKey,r=t.authorizedPubkey,i=Tu(oh.Merge);return(new fu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:Iu,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"withdraw",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.toPubkey,i=t.lamports,o=t.custodianPubkey,a=Tu(oh.Withdraw,{lamports:i}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:Iu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new fu).add({keys:s,programId:this.programId,data:a})}},{key:"deactivate",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=Tu(oh.Deactivate);return(new fu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}]),t}();sh.programId=new Ws("Stake11111111111111111111111111111111111111"),sh.space=200;var uh=U((function t(e,n,r,i){B(this,t),this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=e,this.authorizedVoter=n,this.authorizedWithdrawer=r,this.commission=i})),ch=function(){function t(){B(this,t)}return U(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=Bi("instruction").decode(t.data),r=0,i=Object.entries(lh);r0&&void 0!==arguments[0]?arguments[0]:"voteInit";return Qi([$s("nodePubkey"),$s("authorizedVoter"),$s("authorizedWithdrawer"),Pi("commission")],t)}()])},Authorize:{index:1,layout:Qi([Bi("instruction"),$s("newAuthorized"),Bi("voteAuthorizationType")])},Withdraw:{index:3,layout:Qi([Bi("instruction"),Ui("lamports")])},AuthorizeWithSeed:{index:10,layout:Qi([Bi("instruction"),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return Qi([Bi("voteAuthorizationType"),$s("currentAuthorityDerivedKeyOwnerPubkey"),eu("currentAuthorityDerivedKeySeed"),$s("newAuthorized")],t)}()])}}),hh=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),dh=function(){function t(){B(this,t)}return U(t,null,[{key:"initializeAccount",value:function(t){var e=t.votePubkey,n=t.nodePubkey,r=t.voteInit,i=Tu(lh.InitializeAccount,{voteInit:{nodePubkey:_s(r.nodePubkey.toBuffer()),authorizedVoter:_s(r.authorizedVoter.toBuffer()),authorizedWithdrawer:_s(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:bu,isSigner:!1,isWritable:!1},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new du(o)}},{key:"createAccount",value:function(t){var e=new fu;return e.add(_u.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}},{key:"authorize",value:function(t){var e=t.votePubkey,n=t.authorizedPubkey,r=t.newAuthorizedPubkey,i=t.voteAuthorizationType,o=Tu(lh.Authorize,{newAuthorized:_s(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new fu).add({keys:a,programId:this.programId,data:o})}},{key:"authorizeWithSeed",value:function(t){var e=t.currentAuthorityDerivedKeyBasePubkey,n=t.currentAuthorityDerivedKeyOwnerPubkey,r=t.currentAuthorityDerivedKeySeed,i=t.newAuthorizedPubkey,o=t.voteAuthorizationType,a=t.votePubkey,s=Tu(lh.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:_s(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:_s(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:mu,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new fu).add({keys:u,programId:this.programId,data:s})}},{key:"withdraw",value:function(t){var e=t.votePubkey,n=t.authorizedWithdrawerPubkey,r=t.lamports,i=t.toPubkey,o=Tu(lh.Withdraw,{lamports:r}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new fu).add({keys:a,programId:this.programId,data:o})}},{key:"safeWithdraw",value:function(e,n,r){if(e.lamports>n-r)throw new Error("Withdraw will leave vote account with insuffcient funds.");return t.withdraw(e)}}]),t}();dh.programId=new Ws("Vote111111111111111111111111111111111111111"),dh.space=3731;var fh=new Ws("Va1idator1nfo111111111111111111111111111111"),ph=Mo({name:wo(),website:go(wo()),details:go(wo()),keybaseUsername:go(wo())}),yh=function(){function t(e,n){B(this,t),this.key=void 0,this.info=void 0,this.key=e,this.info=n}return U(t,null,[{key:"fromConfigData",value:function(e){var n=et(e);if(2!==ru(n))return null;for(var r=[],i=0;i<2;i++){var o=new Ws(n.slice(0,Qs)),a=1===(n=n.slice(Qs)).slice(0,1)[0];n=n.slice(1),r.push({publicKey:o,isSigner:a})}if(r[0].publicKey.equals(fh)&&r[1].isSigner){var s=eu().decode(It.from(n)),u=JSON.parse(s);return oo(u,ph),new t(r[1].publicKey,u)}return null}}]),t}(),mh=new Ws("Vote111111111111111111111111111111111111111"),gh=Qi([$s("nodePubkey"),$s("authorizedWithdrawer"),Pi("commission"),Ri(),Yi(Qi([Ri("slot"),Bi("confirmationCount")]),zi(Bi(),-8),"votes"),Pi("rootSlotValid"),Ri("rootSlot"),Ri(),Yi(Qi([Ri("epoch"),$s("authorizedVoter")]),zi(Bi(),-8),"authorizedVoters"),Qi([Yi(Qi([$s("authorizedPubkey"),Ri("epochOfLastAuthorizedSwitch"),Ri("targetEpoch")]),32,"buf"),Ri("idx"),Pi("isEmpty")],"priorVoters"),Ri(),Yi(Qi([Ri("epoch"),Ri("credits"),Ri("prevCredits")]),zi(Bi(),-8),"epochCredits"),Qi([Ri("slot"),Ri("timestamp")],"lastTimestamp")]),vh=function(){function t(e){B(this,t),this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}return U(t,null,[{key:"fromAccountData",value:function(e){var n=gh.decode(_s(e),4),r=n.rootSlot;return n.rootSlotValid||(r=null),new t({nodePubkey:new Ws(n.nodePubkey),authorizedWithdrawer:new Ws(n.authorizedWithdrawer),commission:n.commission,votes:n.votes,rootSlot:r,authorizedVoters:n.authorizedVoters.map(wh),priorVoters:Mh(n.priorVoters),epochCredits:n.epochCredits,lastTimestamp:n.lastTimestamp})}}]),t}();function wh(t){var e=t.authorizedVoter;return{epoch:t.epoch,authorizedVoter:new Ws(e)}}function bh(t){var e=t.authorizedPubkey,n=t.epochOfLastAuthorizedSwitch,r=t.targetEpoch;return{authorizedPubkey:new Ws(e),epochOfLastAuthorizedSwitch:n,targetEpoch:r}}function Mh(t){var e=t.buf,n=t.idx;return t.isEmpty?[]:[].concat(et(e.slice(n+1).map(bh)),et(e.slice(0,n).map(bh)))}var Ah={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function Nh(){return(Nh=_(O().mark((function t(e,n,r,i){var o,a,s,u,c,l,h;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r&&Object.prototype.hasOwnProperty.call(r,"lastValidBlockHeight")||r&&Object.prototype.hasOwnProperty.call(r,"nonceValue")?(o=r,a=i):a=r,s=a&&{skipPreflight:a.skipPreflight,preflightCommitment:a.preflightCommitment||a.commitment,minContextSlot:a.minContextSlot},t.next=4,e.sendRawTransaction(n,s);case 4:return u=t.sent,c=a&&a.commitment,l=o?e.confirmTransaction(o,c):e.confirmTransaction(u,c),t.next=9,l;case 9:if(!(h=t.sent.value).err){t.next=12;break}throw new Error("Raw transaction ".concat(u," failed (").concat(JSON.stringify(h),")"));case 12:return t.abrupt("return",u);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Ih=j(Object.freeze({__proto__:null,Account:Fs,AddressLookupTableAccount:Xu,AddressLookupTableInstruction:Fl,AddressLookupTableProgram:Vl,Authorized:nh,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:Vs,BPF_LOADER_PROGRAM_ID:Ru,BpfLoader:Uu,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:Gl,ComputeBudgetInstruction:Hl,ComputeBudgetProgram:ql,Connection:Ql,Ed25519Program:Jl,Enum:Rs,EpochSchedule:Hu,FeeCalculatorLayout:Su,Keypair:Yl,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:Wl,Loader:Bu,Lockup:rh,MAX_SEED_LENGTH:32,Message:su,MessageAccountKeys:Ks,MessageV0:uu,NONCE_ACCOUNT_LENGTH:Cu,NonceAccount:Du,PACKET_DATA_SIZE:Hs,PUBLIC_KEY_LENGTH:Qs,PublicKey:Ws,SIGNATURE_LENGTH_IN_BYTES:qs,SOLANA_SCHEMA:Us,STAKE_CONFIG_ID:eh,STAKE_INSTRUCTION_LAYOUTS:oh,SYSTEM_INSTRUCTION_LAYOUTS:Pu,SYSVAR_CLOCK_PUBKEY:mu,SYSVAR_EPOCH_SCHEDULE_PUBKEY:gu,SYSVAR_INSTRUCTIONS_PUBKEY:vu,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:wu,SYSVAR_RENT_PUBKEY:bu,SYSVAR_REWARDS_PUBKEY:Mu,SYSVAR_SLOT_HASHES_PUBKEY:Au,SYSVAR_SLOT_HISTORY_PUBKEY:Nu,SYSVAR_STAKE_HISTORY_PUBKEY:Iu,Secp256k1Program:th,SendTransactionError:Gu,SolanaJSONRPCError:qu,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:ah,StakeInstruction:ih,StakeProgram:sh,Struct:Bs,SystemInstruction:zu,SystemProgram:_u,Transaction:fu,TransactionExpiredBlockheightExceededError:Zs,TransactionExpiredNonceInvalidError:Xs,TransactionExpiredTimeoutError:Js,TransactionInstruction:du,TransactionMessage:pu,TransactionStatus:lu,VALIDATOR_INFO_KEY:fh,VERSION_PREFIX_MASK:Gs,VOTE_PROGRAM_ID:mh,ValidatorInfo:yh,VersionedMessage:cu,VersionedTransaction:yu,VoteAccount:vh,VoteAuthorizationLayout:hh,VoteInit:uh,VoteInstruction:ch,VoteProgram:dh,clusterApiUrl:function(t,e){var n=!1===e?"http":"https";if(!t)return Ah[n].devnet;var r=Ah[n][t];if(!r)throw new Error("Unknown ".concat(n," cluster: ").concat(t));return r},sendAndConfirmRawTransaction:function(t,e,n,r){return Nh.apply(this,arguments)},sendAndConfirmTransaction:Eu})),Eh={};Object.defineProperty(Eh,"__esModule",{value:!0});var xh,kh={ERROR_ASSOCIATION_PORT_OUT_OF_RANGE:"ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",ERROR_FORBIDDEN_WALLET_BASE_URL:"ERROR_FORBIDDEN_WALLET_BASE_URL",ERROR_SECURE_CONTEXT_REQUIRED:"ERROR_SECURE_CONTEXT_REQUIRED",ERROR_SESSION_CLOSED:"ERROR_SESSION_CLOSED",ERROR_SESSION_TIMEOUT:"ERROR_SESSION_TIMEOUT",ERROR_WALLET_NOT_FOUND:"ERROR_WALLET_NOT_FOUND"},Th=function(t){Y(n,t);var e=X(n);function n(){var t;B(this,n);for(var r=arguments.length,i=new Array(r),o=0;o=4294967296)throw new Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");var e=new ArrayBuffer(4);return new DataView(e).setUint32(0,t,!1),new Uint8Array(e)}function Dh(){return Sh(this,void 0,void 0,O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}function Oh(){return Sh(this,void 0,void 0,O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}function zh(t,e){return Sh(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=JSON.stringify(t),i=Ch(t.id),o=new Uint8Array(12),crypto.getRandomValues(o),n.next=6,crypto.subtle.encrypt(_h(i,o),e,(new TextEncoder).encode(r));case 6:return a=n.sent,(s=new Uint8Array(i.byteLength+o.byteLength+a.byteLength)).set(new Uint8Array(i),0),s.set(new Uint8Array(o),i.byteLength),s.set(new Uint8Array(a),i.byteLength+o.byteLength),n.abrupt("return",s);case 12:case"end":return n.stop()}}),n)})))}function Ph(t,e){return Sh(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s,u;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t.slice(0,4),i=t.slice(4,16),o=t.slice(16),n.next=5,crypto.subtle.decrypt(_h(r,i),e,o);case 5:if(a=n.sent,s=(void 0===xh&&(xh=new TextDecoder("utf-8")),xh).decode(a),u=JSON.parse(s),!Object.hasOwnProperty.call(u,"error")){n.next=10;break}throw new Lh(u.id,u.error.code,u.error.message);case 10:return n.abrupt("return",u);case 11:case"end":return n.stop()}}),n)})))}function _h(t,e){return{additionalData:t,iv:e,name:"AES-GCM",tagLength:128}}function Bh(t,e,n){return Sh(this,void 0,void 0,O().mark((function r(){var i,o,a,s,u,c,l;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Promise.all([crypto.subtle.exportKey("raw",e),crypto.subtle.importKey("raw",t,{name:"ECDH",namedCurve:"P-256"},!1,[])]);case 2:return i=r.sent,o=tt(i,2),a=o[0],s=o[1],r.next=8,crypto.subtle.deriveBits({name:"ECDH",public:s},n,256);case 8:return u=r.sent,r.next=11,crypto.subtle.importKey("raw",u,"HKDF",!1,["deriveKey"]);case 11:return c=r.sent,r.next=14,crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(a),info:new Uint8Array},c,{name:"AES-GCM",length:128},!1,["encrypt","decrypt"]);case 14:return l=r.sent,r.abrupt("return",l);case 16:case"end":return r.stop()}}),r)})))}function Rh(t){if(t<49152||t>65535)throw new Th(kh.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE,"Association port number must be between 49152 and 65535. ".concat(t," given."),{port:t});return t}function Uh(t){for(var e="",n=new Uint8Array(t),r=n.byteLength,i=0;i1?t.shift():t[0]}}(),u=1,c=0,l={__type:"disconnected"},n.abrupt("return",new Promise((function(e,n){var d,f,p,y={},m=function t(){return Sh(h,void 0,void 0,O().mark((function e(){var n,r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("connecting"===l.__type){e.next=3;break}return console.warn("Expected adapter state to be `connecting` at the moment the websocket opens. "+"Got `".concat(l.__type,"`.")),e.abrupt("return");case 3:return n=l.associationKeypair,d.removeEventListener("open",t),e.next=7,Oh();case 7:return r=e.sent,e.t0=d,e.next=11,jh(r.publicKey,n.privateKey);case 11:e.t1=e.sent,e.t0.send.call(e.t0,e.t1),l={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:r.privateKey};case 14:case"end":return e.stop()}}),e)})))},g=function(t){t.wasClean?l={__type:"disconnected"}:n(new Th(kh.ERROR_SESSION_CLOSED,"The wallet session dropped unexpectedly (".concat(t.code,": ").concat(t.reason,")."),{closeEvent:t})),f()},v=function(t){return Sh(h,void 0,void 0,O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(f(),!(Date.now()-a>=3e4)){t.next=5;break}n(new Th(kh.ERROR_SESSION_TIMEOUT,"Failed to connect to the wallet websocket on port ".concat(i,"."))),t.next=8;break;case 5:return t.next=7,new Promise((function(t){var e=s();p=window.setTimeout(t,e)}));case 7:b();case 8:case"end":return t.stop()}}),t)})))},w=function(r){return Sh(h,void 0,void 0,O().mark((function i(){var o,a,s,h,p,m,g,v;return O().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,r.data.arrayBuffer();case 2:o=i.sent,i.t0=l.__type,i.next="connected"===i.t0?6:"hello_req_sent"===i.t0?30:51;break;case 6:if(i.prev=6,a=o.slice(0,4),(s=new DataView(a).getUint32(0,!1))===c+1){i.next=11;break}throw new Error("Encrypted message has invalid sequence number");case 11:return c=s,i.next=14,Ph(o,l.sharedSecret);case 14:h=i.sent,p=y[h.id],delete y[h.id],p.resolve(h.result),i.next=29;break;case 20:if(i.prev=20,i.t1=i.catch(6),!(i.t1 instanceof Lh)){i.next=28;break}m=y[i.t1.jsonRpcMessageId],delete y[i.t1.jsonRpcMessageId],m.reject(i.t1),i.next=29;break;case 28:throw i.t1;case 29:return i.abrupt("break",51);case 30:return i.next=32,Bh(o,l.associationPublicKey,l.ecdhPrivateKey);case 32:return g=i.sent,l={__type:"connected",sharedSecret:g},v=new Proxy({},{get:function(t,e){if(null==t[e]){var n=e.toString().replace(/[A-Z]/g,(function(t){return"_".concat(t.toLowerCase())})).toLowerCase();t[e]=function(t){return Sh(this,void 0,void 0,O().mark((function r(){var i;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=u++,r.t0=d,r.next=4,zh({id:i,jsonrpc:"2.0",method:n,params:null!=t?t:{}},g);case 4:return r.t1=r.sent,r.t0.send.call(r.t0,r.t1),r.abrupt("return",new Promise((function(t,n){y[i]={resolve:function(r){switch(e){case"authorize":case"reauthorize":var i=r.wallet_uri_base;if(null!=i)try{qh(i)}catch(t){return void n(t)}}t(r)},reject:n}})));case 7:case"end":return r.stop()}}),r)})))}}return t[e]},defineProperty:function(){return!1},deleteProperty:function(){return!1}}),i.prev=35,i.t2=e,i.next=39,t(v);case 39:i.t3=i.sent,(0,i.t2)(i.t3),i.next=46;break;case 43:i.prev=43,i.t4=i.catch(35),n(i.t4);case 46:return i.prev=46,f(),d.close(),i.finish(46);case 50:return i.abrupt("break",51);case 51:case"end":return i.stop()}}),i,null,[[6,20],[35,43,46,50]])})))},b=function(){f&&f(),l={__type:"connecting",associationKeypair:r},void 0===a&&(a=Date.now()),(d=new WebSocket(o,["com.solana.mobilewalletadapter.v1"])).addEventListener("open",m),d.addEventListener("close",g),d.addEventListener("error",v),d.addEventListener("message",w),f=function(){window.clearTimeout(p),d.removeEventListener("open",m),d.removeEventListener("close",g),d.removeEventListener("error",v),d.removeEventListener("message",w)}};b()})));case 13:case"end":return n.stop()}}),n)})))};var Zh=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n>>0,c=new Uint8Array(o);t[n];){var l=e[t.charCodeAt(n)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,n++}for(var f=o-i;f!==o&&0===c[f];)f++;for(var p=new Uint8Array(r+(o-f)),y=r;f!==o;)p[y++]=c[f++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var u=(o-i)*c+1>>>0,l=new Uint8Array(u);i!==o;){for(var h=e[i],d=0,f=u-1;(0!==h||d>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=u-r;p!==u&&0===l[p];)p++;for(var y=s.repeat(n);pthis.span)throw new RangeError("indeterminate span");return this.span}},{key:"replicate",value:function(t){var e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}},{key:"fromArray",value:function(t){}}]),t}();function sd(t,e){return e.property?t+"["+e.property+"]":t}od.Layout=ad,od.nameWithProperty=sd,od.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof ad))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=function(){return new t},Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};var ud=function(t){Y(n,t);var e=X(n);function n(){return B(this,n),e.apply(this,arguments)}return U(n,[{key:"isCount",value:function(){throw new Error("ExternalLayout is abstract")}}]),n}(ad),cd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");return(i=e.call(this,-1,r)).elementSpan=t,i}return U(n,[{key:"isCount",value:function(){return!0}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.length-e;return Math.floor(n/this.elementSpan)}},{key:"encode",value:function(t,e,n){return 0}}]),n}(ud),ld=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;if(B(this,n),!(t instanceof ad))throw new TypeError("layout must be a Layout");if(void 0===r)r=0;else if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");return(o=e.call(this,t.span,i||t.property)).layout=t,o.offset=r,o}return U(n,[{key:"isCount",value:function(){return this.layout instanceof hd||this.layout instanceof dd}},{key:"decode",value:function(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}]),n}(ud),hd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readUIntLE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}]),n}(ad),dd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readUIntBE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}]),n}(ad),fd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readIntLE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeIntLE(t,n,this.span),this.span}}]),n}(ad),pd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readIntBE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeIntBE(t,n,this.span),this.span}}]),n}(ad),yd=Math.pow(2,32);function md(t){var e=Math.floor(t/yd);return{hi32:e,lo32:t-e*yd}}function gd(t,e){return t*yd+e}var vd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.readUInt32LE(e);return gd(t.readUInt32LE(e+4),n)}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=md(t);return e.writeUInt32LE(r.lo32,n),e.writeUInt32LE(r.hi32,n+4),8}}]),n}(ad),wd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),gd(t.readUInt32BE(e),t.readUInt32BE(e+4))}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=md(t);return e.writeUInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}]),n}(ad),bd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.readUInt32LE(e);return gd(t.readInt32LE(e+4),n)}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=md(t);return e.writeUInt32LE(r.lo32,n),e.writeInt32LE(r.hi32,n+4),8}}]),n}(ad),Md=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),gd(t.readInt32BE(e),t.readUInt32BE(e+4))}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=md(t);return e.writeInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}]),n}(ad),Ad=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,4,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readFloatLE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeFloatLE(t,n),4}}]),n}(ad),Nd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,4,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readFloatBE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeFloatBE(t,n),4}}]),n}(ad),Id=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readDoubleLE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeDoubleLE(t,n),8}}]),n}(ad),Ed=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readDoubleBE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeDoubleBE(t,n),8}}]),n}(ad),xd=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;if(B(this,n),!(t instanceof ad))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof ud&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var a=-1;return!(r instanceof ud)&&0u.span&&void 0===u.property)throw new Error("fields cannot contain unnamed variable-length layout")}}catch(t){s.e(t)}finally{s.f()}var c=-1;try{c=t.reduce((function(t,e){return t+e.getSpan()}),0)}catch(t){}return(o=e.call(this,c,r)).fields=t,o.decodePrefixes=!!i,o}return U(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0;try{n=this.fields.reduce((function(n,r){var i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n,r=this.makeDestinationObject(),i=st(this.fields);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(void 0!==o.property&&(r[o.property]=o.decode(t,e)),e+=o.getSpan(t,e),this.decodePrefixes&&t.length===e)break}}catch(t){i.e(t)}finally{i.f()}return r}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r,i=n,o=0,a=0,s=st(this.fields);try{for(s.s();!(r=s.n()).done;){var u=r.value,c=u.span;if(a=0c&&(c=u.getSpan(e,n)))}o=n,n+=c}}catch(t){s.e(t)}finally{s.f()}return o+a-i}},{key:"fromArray",value:function(t){var e,n=this.makeDestinationObject(),r=st(this.fields);try{for(r.s();!(e=r.n()).done;){var i=e.value;void 0!==i.property&&0i.span?n=-1:0<=n&&(n+=i.span)}}catch(t){r.e(t)}finally{r.f()}}}]),n}(ad),Td=function(){function t(e){B(this,t),this.property=e}return U(t,[{key:"decode",value:function(){throw new Error("UnionDiscriminator is abstract")}},{key:"encode",value:function(){throw new Error("UnionDiscriminator is abstract")}}]),t}(),Ld=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),!(t instanceof ud&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return(i=e.call(this,r||t.property||"variant")).layout=t,i}return U(n,[{key:"decode",value:function(t,e){return this.layout.decode(t,e)}},{key:"encode",value:function(t,e,n){return this.layout.encode(t,e,n)}}]),n}(Td),Sd=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;B(this,n);var a=t instanceof hd||t instanceof dd;if(a)t=new Ld(new ld(t));else if(t instanceof ud&&t.isCount())t=new Ld(t);else if(!(t instanceof Td))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===r&&(r=null),!(null===r||r instanceof ad))throw new TypeError("defaultLayout must be null or a Layout");if(null!==r){if(0>r.span)throw new Error("defaultLayout must have constant span");void 0===r.property&&(r=r.replicate("content"))}var s=-1;r&&0<=(s=r.span)&&a&&(s+=t.layout.span),(o=e.call(this,s,i)).discriminator=t,o.usesPrefixDiscriminator=a,o.defaultLayout=r,o.registry={};var u=o.defaultGetSourceVariant.bind(Z(o));return o.getSourceVariant=function(t){return u(t)},o.configGetSourceVariant=function(t){u=t.bind(this)},o}return U(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}},{key:"defaultGetSourceVariant",value:function(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;var e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(var n in this.registry){var r=this.registry[n];if(t.hasOwnProperty(r.property))return r}throw new Error("unable to infer src variant")}},{key:"decode",value:function(t,e){var n;void 0===e&&(e=0);var r=this.discriminator,i=r.decode(t,e),o=this.registry[i];if(void 0===o){var a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),(n=this.makeDestinationObject())[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+a)}else n=o.decode(t,e);return n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=this.getSourceVariant(t);if(void 0===r){var i=this.discriminator,o=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=i.layout.span),i.encode(t[i.property],e,n),a+o.encode(t[o.property],e,n+a)}return r.encode(t,e,n)}},{key:"addVariant",value:function(t,e,n){var r=new jd(this,t,e,n);return this.registry[t]=r,r}},{key:"getVariant",value:function(t,e){var n=t;return It.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}]),n}(ad),jd=function(t){Y(n,t);var e=X(n);function n(t,r,i,o){var a;if(B(this,n),!(t instanceof Sd))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof i&&void 0===o&&(o=i,i=null),i){if(!(i instanceof ad))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=i.span&&i.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof o)throw new TypeError("variant must have a String property")}var s=t.span;return 0>t.span&&0<=(s=i?i.span:0)&&t.usesPrefixDiscriminator&&(s+=t.discriminator.layout.span),(a=e.call(this,s,o)).union=t,a.variant=r,a.layout=i||null,a}return U(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}},{key:"decode",value:function(t,e){var n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");var r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);var i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}},{key:"fromArray",value:function(t){if(this.layout)return this.layout.fromArray(t)}}]),n}(ad);function Cd(t){return 0>t&&(t+=4294967296),t}var Dd=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;if(B(this,n),!(t instanceof hd||t instanceof dd))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof r&&void 0===i&&(i=r,r=void 0),4=n)throw new TypeError("bits must be positive integer");var i=8*e.span,o=e.fields.reduce((function(t,e){return t+e.bits}),0);if(n+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=n,this.valueMask=(1<>>this.start}},{key:"encode",value:function(t){if(!Number.isInteger(t)||t!==Cd(t&this.valueMask))throw new TypeError(sd("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var e=this.container._packedGetValue(),n=Cd(t<n&&(n=this.length.decode(t,e)),n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}},{key:"encode",value:function(t,e,n){var r=this.length;if(this.length instanceof ud&&(r=t.length),!It.isBuffer(t)||r!==t.length)throw new TypeError(sd("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof ud&&this.length.encode(r,e,n),r}}]),n}(ad),_d=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,-1,t)}return U(n,[{key:"getSpan",value:function(t,e){if(!It.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);for(var n=e;ne.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}]),n}(ad),Bd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),"string"==typeof t&&void 0===r&&(r=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");return(i=e.call(this,-1,r)).maxSpan=t,i}return U(n,[{key:"getSpan",value:function(t,e){if(!It.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}},{key:"decode",value:function(t,e,n){void 0===e&&(e=0);var r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}]),n}(ad),Rd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;return B(this,n),(i=e.call(this,0,r)).value=t,i}return U(n,[{key:"decode",value:function(t,e,n){return this.value}},{key:"encode",value:function(t,e,n){return 0}}]),n}(ad);od.ExternalLayout=ud,od.GreedyCount=cd,od.OffsetLayout=ld,od.UInt=hd,od.UIntBE=dd,od.Int=fd,od.IntBE=pd,od.Float=Ad,od.FloatBE=Nd,od.Double=Id,od.DoubleBE=Ed,od.Sequence=xd,od.Structure=kd,od.UnionDiscriminator=Td,od.UnionLayoutDiscriminator=Ld,od.Union=Sd,od.VariantLayout=jd,od.BitStructure=Dd,od.BitField=Od,od.Boolean=zd,od.Blob=Pd,od.CString=_d,od.UTF8=Bd,od.Constant=Rd,od.greedy=function(t,e){return new cd(t,e)},od.offset=function(t,e,n){return new ld(t,e,n)},od.u8=function(t){return new hd(1,t)},od.u16=function(t){return new hd(2,t)},od.u24=function(t){return new hd(3,t)},od.u32=function(t){return new hd(4,t)},od.u40=function(t){return new hd(5,t)},od.u48=function(t){return new hd(6,t)},od.nu64=function(t){return new vd(t)},od.u16be=function(t){return new dd(2,t)},od.u24be=function(t){return new dd(3,t)},od.u32be=function(t){return new dd(4,t)},od.u40be=function(t){return new dd(5,t)},od.u48be=function(t){return new dd(6,t)},od.nu64be=function(t){return new wd(t)},od.s8=function(t){return new fd(1,t)},od.s16=function(t){return new fd(2,t)},od.s24=function(t){return new fd(3,t)},od.s32=function(t){return new fd(4,t)},od.s40=function(t){return new fd(5,t)},od.s48=function(t){return new fd(6,t)},od.ns64=function(t){return new bd(t)},od.s16be=function(t){return new pd(2,t)},od.s24be=function(t){return new pd(3,t)},od.s32be=function(t){return new pd(4,t)},od.s40be=function(t){return new pd(5,t)},od.s48be=function(t){return new pd(6,t)},od.ns64be=function(t){return new Md(t)},od.f32=function(t){return new Ad(t)},od.f32be=function(t){return new Nd(t)},od.f64=function(t){return new Id(t)},od.f64be=function(t){return new Ed(t)},od.struct=function(t,e,n){return new kd(t,e,n)},od.bits=function(t,e,n){return new Dd(t,e,n)};var Ud=od.seq=function(t,e,n){return new xd(t,e,n)};od.union=function(t,e,n){return new Sd(t,e,n)},od.unionLayoutDiscriminator=function(t,e){return new Ld(t,e)},od.blob=function(t,e){return new Pd(t,e)},od.cstr=function(t){return new _d(t)},od.utf8=function(t,e){return new Bd(t,e)},od.const=function(t,e){return new Rd(t,e)};var Qd={},Yd={exports:{}};!function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"===z(t)?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:nr.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"===z(t))return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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 p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}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 r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.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;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 I(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){I.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return v[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,I),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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,L)}(Yd),function(t){var e=L&&L.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;var n=od,r=Ih,i=e(Yd.exports),o=od;Object.defineProperty(t,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(t,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(t,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(t,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(t,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(t,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(t,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(t,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return o.struct}});var a=function(t){Y(r,t);var e=X(r);function r(t,i,o){var a;return B(this,r),(a=e.call(this,t,o)).blob=n.blob(t),a.signed=i,a}return U(r,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new i.default(this.blob.decode(t,e),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.signed&&(t=t.toTwos(8*this.span)),this.blob.encode(t.toArrayLike(It,"le",this.span),e,n)}}]),r}(n.Layout);function s(t){return new a(8,!1,t)}t.u64=s,t.i64=function(t){return new a(8,!0,t)},t.u128=function(t){return new a(16,!1,t)},t.i128=function(t){return new a(16,!0,t)};var u=function(t){Y(n,t);var e=X(n);function n(t,r,i,o){var a;return B(this,n),(a=e.call(this,t.span,o)).layout=t,a.decoder=r,a.encoder=i,a}return U(n,[{key:"decode",value:function(t,e){return this.decoder(this.layout.decode(t,e))}},{key:"encode",value:function(t,e,n){return this.layout.encode(this.encoder(t),e,n)}},{key:"getSpan",value:function(t,e){return this.layout.getSpan(t,e)}}]),n}(n.Layout);t.publicKey=function(t){return new u(n.blob(32),(function(t){return new r.PublicKey(t)}),(function(t){return t.toBuffer()}),t)};var c=function(t){Y(r,t);var e=X(r);function r(t,i){var o;return B(this,r),(o=e.call(this,-1,i)).layout=t,o.discriminator=n.u8(),o}return U(r,[{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==t?this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+1)+1)}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+1);throw new Error("Invalid option "+this.property)}},{key:"getSpan",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(t,e);if(0===n)return 1;if(1===n)return this.layout.getSpan(t,e+1)+1;throw new Error("Invalid option "+this.property)}}]),r}(n.Layout);function l(t){if(0===t)return!1;if(1===t)return!0;throw new Error("Invalid bool: "+t)}function h(t){return t?1:0}function d(t){var e=n.u32("length"),r=n.struct([e,n.blob(n.offset(e,-e.span),"data")]);return new u(r,(function(t){return t.data}),(function(t){return{data:t}}),t)}t.option=function(t,e){return new c(t,e)},t.bool=function(t){return new u(n.u8(),l,h,t)},t.vec=function(t,e){var r=n.u32("length"),i=n.struct([r,n.seq(t,n.offset(r,-r.span),"values")]);return new u(i,(function(t){return t.values}),(function(t){return{values:t}}),e)},t.tagged=function(t,e,r){var i=n.struct([s("tag"),e.replicate("data")]);return new u(i,(function(e){var n=e.tag,r=e.data;if(!n.eq(t))throw new Error("Invalid tag, expected: "+t.toString("hex")+", got: "+n.toString("hex"));return r}),(function(e){return{tag:t,data:e}}),r)},t.vecU8=d,t.str=function(t){return new u(d(),(function(t){return t.toString("utf-8")}),(function(t){return It.from(t,"utf-8")}),t)},t.rustEnum=function(t,e,r){var i=n.union(null!=r?r:n.u8(),e);return t.forEach((function(t,e){return i.addVariant(e,t,t.property)})),i},t.array=function(t,e,r){var i=n.struct([n.seq(t,e,"values")]);return new u(i,(function(t){return t.values}),(function(t){return{values:t}}),r)};var f=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;return B(this,n),(o=e.call(this,t.span+r.span,i)).keyLayout=t,o.valueLayout=r,o}return U(n,[{key:"decode",value:function(t,e){return e=e||0,[this.keyLayout.decode(t,e),this.valueLayout.decode(t,e+this.keyLayout.getSpan(t,e))]}},{key:"encode",value:function(t,e,n){n=n||0;var r=this.keyLayout.encode(t[0],e,n);return r+this.valueLayout.encode(t[1],e,n+r)}},{key:"getSpan",value:function(t,e){return this.keyLayout.getSpan(t,e)+this.valueLayout.getSpan(t,e)}}]),n}(n.Layout);t.map=function(t,e,r){var i=n.u32("length"),o=n.struct([i,n.seq(new f(t,e),n.offset(i,-i.span),"values")]);return new u(o,(function(t){var e=t.values;return new Map(e)}),(function(t){return{values:Array.from(t.entries())}}),r)}}(Qd),ut.Web3MobileWallet;var Wd=ut.transact,Fd=nr.Buffer,Vd=pr.exports,Hd=Qd.struct([Qd.publicKey("mint"),Qd.publicKey("owner"),Qd.u64("amount"),Qd.u32("delegateOption"),Qd.publicKey("delegate"),Qd.u8("state"),Qd.u32("isNativeOption"),Qd.u64("isNative"),Qd.u64("delegatedAmount"),Qd.u32("closeAuthorityOption"),Qd.publicKey("closeAuthority")]);Qd.array;var Gd=Qd.bool,qd=Qd.i128;Qd.i16;var Zd=Qd.i32,Jd=Qd.i64;Qd.i8,Qd.map;var Xd=Qd.option,Kd=Qd.publicKey,$d=Qd.rustEnum,tf=Qd.str,ef=Qd.struct;Qd.tagged;var nf=Qd.u128,rf=Qd.u16,of=Qd.u32,af=Qd.u64,sf=Qd.u8,uf=Qd.vec;Qd.vecU8;const cf="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yOTkuMyAyMzcuNSA1MDAgMTIybDIwMC43IDExNS41LTczLjUgNDIuNkw1MDAgMjA4LjJsLTEyNy4xIDcxLjktNzMuNi00Mi42em00MDEuNCAxNDYtNzMuNS00Mi42LTEyNy4xIDczTDM3MyAzNDAuNGwtNzMuNSA0My4xdjg1LjdsMTI3LjEgNzN2MTQ1LjRsNzMuNSA0My4xIDczLjUtNDMuMVY1NDIuMWwxMjcuMS03M3YtODUuNnptMCAyMzIuMXYtODUuN2wtNzMuNSA0Mi42djg1LjdjLS4xLS42IDczLjUtNDIuNiA3My41LTQyLjZ6bTUxLjkgMjkuMy0xMjcuMSA3M3Y4NS43TDgyNi4xIDY4OFY0NTYuNGwtNzMuNSA0My4xdjE0NS40em0tNzMuNS0zMzQuNCA3My41IDQzLjF2ODUuN2w3My41LTQzLjF2LTg1LjdsLTczLjUtNDMuMS03My41IDQzLjF6TTQyNi41IDc0OS40djg1LjdsNzMuNSA0My4xIDczLjUtNDMuMXYtODUuN2wtNzMuNSA0Mi03My41LTQyek0yOTkuMyA2MTUuNmw3My41IDQzLjF2LTg2LjJMMjk5LjMgNTMwdjg1LjZ6bTEyNy4yLTMwNS4xIDczLjUgNDMuMSA3My41LTQzLjEtNzMuNS00Mi42YzAtLjUtNzMuNSA0Mi42LTczLjUgNDIuNnptLTE3OS4xIDQzLjEgNzMuNS00My4xLTczLjUtNDMuMS03My41IDQzLjF2ODUuN2w3My41IDQzLjF2LTg1Ljd6bTAgMTQ1LjQtNzMuNS00Mi42VjY4OGwyMDAuNyAxMTUuNXYtODUuN2wtMTI3LjEtNzNjLS4xLjEtLjEtMTQ1LjgtLjEtMTQ1Ljh6IiBmaWxsPSIjZjBiOTBiIi8+PC9zdmc+",lf="https://app.uniswap.org/static/media/bnb-logo.797868eb94521320b78e3967134febbe.svg";var hf={name:"bsc",id:"0x38",networkId:"56",namespace:"eip155",platform:"evm",label:"BNB Smart Chain",fullName:"BNB Smart Chain Mainnet",logo:cf,logoBackgroundColor:"#000000",logoWhiteBackground:cf,currency:{name:"BNB",symbol:"BNB",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:lf},wrapped:{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png"},stables:{usd:["0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d","0x55d398326f99059fF775485246999027B3197955"]},explorer:"https://bscscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://bscscan.com/tx/${t.id||t}`:e?`https://bscscan.com/token/${e}`:n?`https://bscscan.com/address/${n}`:void 0,endpoints:["https://bsc-dataseed.binance.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed3.defibit.io"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"BNB",name:"Binance Coin",decimals:18,logo:lf,type:"NATIVE"},{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",symbol:"WBNB",name:"Wrapped BNB",decimals:18,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png",type:"20"},{address:"0x55d398326f99059fF775485246999027B3197955",symbol:"USDT",name:"Tether USD",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x55d398326f99059fF775485246999027B3197955/logo.png",type:"20"},{address:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",symbol:"USDC",name:"USD Coin",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d/logo.png",type:"20"},{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:"ETH",name:"Ethereum Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x2170Ed0880ac9A755fd29B2688956BD959F933F8/logo.png",type:"20"},{address:"0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",symbol:"Cake",name:"PancakeSwap Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82/logo.png",type:"20"},{address:"0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",symbol:"BTCB",name:"BTCB Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const df="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAADxdJREFUeJztXVtzFMcVplwuP8VVeYmf7HJ+RKqSl/AQP6X8H+yqXUEIjhMnQY5jO9oVCIzA5mowdzAYG4xAGAyWLC5G3IyDL8gOASUYKrarYGZWC7qi23b6692VV6uZ7e6ZnT3di07VV6JUaLfnnG+6z+lz+vScOXUoL6SzP52/2PtlQ9p7piHlLU2k3P2JJqcjkXLO8589/OdN/tPjvx8VEP8Wv+sp/J8O/A3+Fp+Bz8JnUj/XrPjIwjT7ybxm57fJlLsy2eR2cwPe4QZksYB/Nr4D34XvxHdTP/8DJ+k0e4S/lb9Jpr2WZJNzgRtjPDaDS4DvFmPgY8GYMDZq/dStNKQzv0qmnA1c6RkqgysQIoMxYqzU+qoLWZDO/jyZdl7lir1ObdwQZLiOseMZqPVonSTS7i+4AtsTTW6O2pDR4ebEs/Bnotar8dKw2Pk1n0I76Y0W16zgdOIZqfVsnCSbvaeEB2+AkWpCBEQS/Jmp9U4u3Fl6nIdWB6gNQgb+7NABtR1qLjxcejiZdhfxKXGA3AjUswHXAXQBnVDbpSbCPeO5fAr8hlrxpgE6gW6o7ROb5N96Z3l9ePZxgUcMXEd1NxssbMk8kWxyztEr2A5AV3XjGySb3acTSLYYoFjL4EF31PYLLXwaeyiZcltnp/woEJtIrdAltT21BEkR7tnuo1dgfQC6tCbRlGh1H02k3C5qpalg/bt3WdOGDPk4lACdct1S27eiLEgPPMbDmcvkylLAgiUOc/sm2LHuITavmX48KoBun1828DNqO/tKsiX7JF+zeqmVpIqPzg2xyckc++Sfw2ImoB6POtxe6Jra3tMEb75Nxv/Hmxk2MZGbIsCpz4bZn1d45OPSIQF0Tm13IViXbJn2i+i9NcYgRQIA+zsGyMelA6Fzap8AnqktDl8RO9r7WVFKCQAs3dJHPj4tcN2TRQcizrcs1Hv+NZf1D04GEqDj/JBwDqnHqYNCiFj7fYL8Jg+9AnTQfXmYlUo5AYAtbffIx6lNAm6L2hpfbO/atcO3dGsfy+VyUgIAL66yySEE3FzNto2R2ElYtrffkHbYd7fHWbkEEeDQyUHk6cnHrQkPtonV+CKla2FWDx6+nwQRAFi5K0s+bl3ANrGmkvP5fPoH1cFfX/fYyP2cNgG6Lg6z55a55OPXJgG3UVzGn2vbug98fvW+r/FlBADePtJPPn59iKKS6lYW5ad++8q4Vu+5G2h8FQIAr663JFlUAtiqqksBZ1Uj9UPp4neLHeb0TUQmwNEzg2xemv559OE2VsX4KE2ysXoXhpOJCgGAdXttShblAZtVpayMe5Zt1A+ji5fXZdj4uL/jF4YApy4NsxdaLXQIue2iGb/Ze4r6IcLg6rejUuPrEAB47yO7kkVTJIhyAsnG41rYylUVHQIAizdZlixqyh9DC2V8HGKkHrwuELffHZiUWz4kAVBEAueS+jl1EepAqo2ndLFW64guAYBNB2xMFjmdWsbHWXbqQesC0zMMGjcBgEVv2JYs4tDpT5BvzmDAoBWBxM2tH8a0jB+FAAe77EsWwaZKxkdLE9u2fPce65dbu4oEAFp32JYscnNK7WrQ14Z+sOpAMefwiLrjVy0CdF0cYguX2rU3ANtKCWBTdS9wqWcklPGjEgDYcdiuZBEaV1U0PtqbUQ9SB6/vyoY2fjUIALy81q5kUcUWduhxRz1AVcxvdthtb2aVT60JcOT0oKg4otaHKmBjX+OLA50GN2Esx+FT8mRPLQgAIO1MrQ91ArgZ31JytDqlHpwqXlrjsbExvZg/TgKcvDTM/rjcHocQtp45/ae9FuqBqeLr/6gle2pFAAChKLVeVAFbzyRAk3OBemAq2LhfPdlTSwIA6Y12JItg62nGR9tzyq7bqljY4rK+e5WrfCgJcPzskHBOqfUkJQC39bRW9+h9Tz0oFXx8Yahqxo+DAMCGfXY4hLB5SfjnrqQekAypjRntZA8FAU5/NixK0an1JQNsXrL+m1/4ceM7/WRPJcExsas3Rtn7nQNVJ8GBj82vHppWKBLrNStVAOrzqyWjPHzEWQGEbjBW81t9bPn2LNt9tF/UE1SLBMu2Ge4QcpsL4+MyJPLBVADi68HhcMmeUrnbP8kufDUyw8ggQBHoD7Dt4D3WyX2NqASAv/L7Fnr9VYK4CAs3YlEPpBLOfxk+2QP5wRlnZy7ztTnAUKUEKGLJpj72JnfmUFoehQTbDpldPQTb8/Xfe5Z6IEHA1BxWem+N8rdd/ib7EaAUq/dkxZoelgTYtaTWYxBwJR7y/8uoB+IHnMbB26sjY+M59uU1vr5/qj6FywhQxIodWfbOh/2ioZQOAZCzMLV6CLafU7hUkXww5Wjr8j/S7Sdo+3LxyojSGx+WAFN+wtY+tp1P7V0afsIbbxtaPcRtb2T1b+Mqj90flcf8t91x1v158PoeBwGKWLy5j23kfsIxBT/h5KfDoj8RtV7LIaqFTcwBfHUt+Eg35L//G2WnqxSyhSVAKdZwP+FgV2U/Yc9R85JFIieQwH25BgymCHTt9JPxiRy7ch3xe/QQrdoEKGLlzqzICgb5CQb2Je6ZU7g0mXogAmjR5mWnJ3uwB3Dp65nxu4kEKGIZ9xN2tN9jJy5OJ6txfYm57TEDGNPwCdm0otzJTLCzX+T31uMwfJwEmNpP2NLHNu2/y453/0gEw/oSe3MK16dTD2Sqf+/N78diN3qtCDDlMG7qY2v33mWHTg6Y1ZeY294YAhw7Ozi1P19L1IIA0/yEXdxpfMeQWUAQwJAlAClUtHOrdwL8fW3GpBPGnlFOIIDp8lh3dT19EwiAJe4PprWdKziBRoWBALaB1/JpEhsothMAdYJY8w3dDhZh4HkDBuIL7J7t+qDfWgKg57BRYV85uO0xA3SQD0SCl9ZkRP9eWwjwyrqM8bUABXQYkwySpU0xhb62Lcs6z5u7E4idPpUDIn8ypeOYSAYZkg5esTPLPr0yIu2+gd1CnA3QTcvGSYA0B6IY2TpfXNLQxo5a30BDyluKI2HPUA+kCHj/qNlDDl0WKsGxevd49LAxqvGxPM2XjBV+AJpNYp/DpJ1AURBiUkkYvP9i9S9yAnjTZX+DaffoJ+H9g7CGR1j3nEKDCIS12OLGd6HGwaRoQJSEmVYU+rfVHhu+/2MR6LWbo+JMQGUmO6Lo4kSIsDFMWKfSNRRLWWnJOdrPm3aAVBSFmlgWXt7sEQc4kB+QKRBv5Pb2e7ERAIUqssbROL629eDMMSzZbFiZeLEs3NSDISjhLpeh4Umx7ssaMiD+bpMUaOgQAE6b7DYxjAkdS7ouzoxScFUdtT7LMe1giIlHw/AmORn/g6AoFlWps0OdP7p7hiUA/AuVUi74A+gU4vf5KC2XOYkkBCg9Gmbq4VBMm0gRBwkqgGX7B1A+PO+ggpKgsO4vK+VhHXwBVAAFkQuhqqk3kE07HGry8XDU5FcStIWHl40Zo9LnwH9AXZ6MAHBCZUe8EaLiFLBsL2LVbjOrgWccDze5QQTeQpX27zj6tV3hJM4r6zPsg5Lpemr7lv9eRiIA5V4dCruR+wxuLz+jQYTpLWIwHQ8MqZ0P/Pb7MdYiuQMYpMLOI87vIcRU2ZrFUnPwhNp+A7arTb5xzLdFjOlNorCTpio4+o0zhSBOpc+EZy+LKJDD33lYLyNpYPXvNPg2ibKhTRzqA3QE9wUiHAzTtgXx/po9+jUJpreTD2wTlw8HzW4UCY/e7wpYmSCc1NmDRxQQpioJOQzTbxgLbBSZXwbMbxWLmDtsj8B/3RiteA8gMnr7QtYlItEjW3JMQMVWsflZwL1OPUgZEM6FFWwrI2dQWp+H4o3NB/S2kMuBo+zUepFB2ixaEMCSdvFf/Lvy+UGZIKpAW5hiNBDF+Cae+/MlgEq7eFsujMAWbdSegdXoEoZNKFmewAwoXhhRWAasuDIGTRuitI57kNrFK18ZA7Hp0qgPz4RvHhmVACZV90ihc2lUfhYwr3GEHxrS4XsIRiEAchQmVfdUgva1cRCbLo58sayKKG4CIOdvWnVPxZckzMWRYhYwsFAkCDpXxkYlgHHVPRUQ+upYQQDLLo/W7SkYhgAoOaN+Ti0CRLk8GpJIOQeoH0IVSOfeCagiqgYBUH1sYnVPILjtIhkf0pDOPM6diAHyh1EEpufxClVEYQmA4o9Gi66Mhc1gu8gEgCTT7iLqB9KBrIooDAGM7fUXRABus6oYH5JOs4e5M/EN9UNpsF+0gq8WAd4zuLrH9/m5rWCzqhEAkkw7c23YIi4CmTl0EI1KAFHdY9UVsW4Otqqq8UtIsJz+AdWBJhNRCYD0M/Vz6AA2isX4kPxS4JyjfkgdVKoikhHgrfctC/m4bao+9ZfLwpbMEwlDGkupoFIVUSUCtJ80v7qnDB5sE6vxi5Jsdp+2yR9AFdCoTxVREAEwaxjTy08JfN3nNqmJ8adIkHJb6R9cHbt9qoiCCIBOJNTj1QFsUVPjQ/ha8xCPNfdRP7wOcFmUjAC7j9hR3TNlfG4D2KLmBCiQ4JFEyu2iVoIqyquIyglgT3VPAVz3gSXetZJEq/tossm9TK4MRbSWVBGVEwDtXqjHpwqhc657UuMXZUF64DHuiPRSK0UVOLJdTgCcPKIelzrcXuic2u7TJNmSfdIWEhSriIoEsKm6BzqGrqnt7StgpS3LAc7to+MIqntMvM/HD9CtcW9+uWBdssUxxDk+dPGiHocSoFNT1nyZiIOmloWIJqMQ6tF6+7oi9gnEZpE9O4bmwc1Bh2RxfjUkv21sT+7AIHg1396NS5CksC2LSAnoqmaJnVqJSCWLeoLZJSEYophjeewpXUpBtYpN5WW1AnQSWyWPaQKGc7Y32lRtHJvhhQ7cxrp+64NElJw3OW3URqB76522qpVu2yw4vWLTMbTohne7I5/YqUfBIUZbTiWHMjx/ttAHNR8kwVn2fJOKeogYxGZOu/b5/FnJt6vJ9yyyI8tYZvhejF25LcusVBa0N0OPO5ObWWJsGKO0FdushBckRdDqFP1u0fSYsss5vluMgY8FY7IuYVMPgrbn6H2PCxBEJBHn9Tf8s4UHz78L3zmj5fqsmCG4DAk3YiWbvGfFvYgpdz888EJL/J7Chdkerk8XEP8Wv+vJzyo8EsHf8L/FZ+Czpi5YqjP5P2ey0rAsl+yGAAAAAElFTkSuQmCC",ff="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png";var pf={name:"ethereum",id:"0x1",networkId:"1",namespace:"eip155",platform:"evm",label:"Ethereum",fullName:"Ethereum Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbC1vcGFjaXR5Oi42MDJ9LnN0MCwuc3Qxe2ZpbGw6I2ZmZn08L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik01MTEuNCA3My4zdjMxNS41TDc3OCA1MDggNTExLjQgNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNTExLjQgNzMuMyAyNDQuNyA1MDhsMjY2LjYtMTE5LjJWNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNNTExLjQgNzEyLjN2MjE0LjVsMjY2LjgtMzY5LjEtMjY2LjggMTU0LjZ6Ii8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTUxMS40IDkyNi43VjcxMi4zTDI0NC43IDU1Ny42bDI2Ni43IDM2OS4xeiIvPjxwYXRoIGQ9Ik01MTEuNCA2NjIuNyA3NzggNTA4IDUxMS40IDM4OC44djI3My45eiIgZmlsbD0iI2ZmZiIgZmlsbC1vcGFjaXR5PSIuMiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im0yNDQuNyA1MDggMjY2LjYgMTU0LjdWMzg4LjhMMjQ0LjcgNTA4eiIvPjwvc3ZnPgo=",logoBackgroundColor:"#5683ec",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGltYWdlLXJlbmRlcmluZz0ib3B0aW1pemVRdWFsaXR5IiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgdGV4dC1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4PSIwIiB5PSIwIiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGU+LnN0MXtmaWxsOiM4YzhjOGN9PC9zdHlsZT48cGF0aCBkPSJtNDk5LjggNzcuNS01LjUgMTl2NTU5LjFsNS41IDUuNSAyNTkuNy0xNTMuNUw0OTkuOCA3Ny41eiIgZmlsbD0iIzM0MzQzNCIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Im00OTkuOCA3Ny41LTI1OS4zIDQzMEw0OTkuOCA2NjFWNzcuNXoiLz48cGF0aCBkPSJtNDk5LjggNzEwLjMtMi45IDR2MTk5LjFsMi45IDkuMSAyNTkuNy0zNjUuOC0yNTkuNyAxNTMuNnoiIGZpbGw9IiMzYzNjM2IiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNDk5LjggOTIyLjVWNzEwLjNMMjQwLjUgNTU2LjdsMjU5LjMgMzY1Ljh6Ii8+PHBhdGggZD0ibTQ5OS44IDY2MSAyNTkuNy0xNTMuNS0yNTkuNy0xMTcuOFY2NjF6IiBmaWxsPSIjMTQxNDE0Ii8+PHBhdGggZD0iTTI0MC41IDUwNy41IDQ5OS44IDY2MVYzODkuN0wyNDAuNSA1MDcuNXoiIGZpbGw9IiMzOTM5MzkiLz48L3N2Zz4K",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:df},wrapped:{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",logo:ff,logoBackgroundColor:"#FFFFFF"},stables:{usd:["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]},explorer:"https://etherscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://etherscan.io/tx/${t.id||t}`:e?`https://etherscan.io/token/${e}`:n?`https://etherscan.io/address/${n}`:void 0,endpoints:["https://rpc.ankr.com/eth","https://eth.llamarpc.com","https://ethereum.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:df,type:"NATIVE"},{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:ff,type:"20"},{address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c/logo.png",type:"20"},{address:"0xdAC17F958D2ee523a2206206994597C13D831ec7",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x6B175474E89094C44Da98b954EedeAC495271d0F",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x853d955aCEf822Db058eb8505911ED77F175b99e",symbol:"FRAX",name:"Frax",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x853d955aCEf822Db058eb8505911ED77F175b99e/logo.png",type:"20"},{address:"0x956F47F50A910163D8BF957Cf5846D573E7f87CA",symbol:"FEI",name:"Fei USD",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x956F47F50A910163D8BF957Cf5846D573E7f87CA/logo.png",type:"20"},{address:"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const yf="https://assets.spooky.fi/tokens/FTM.png",mf="https://assets.spooky.fi/tokens/wFTM.png";var gf={name:"fantom",id:"0xfa",networkId:"250",namespace:"eip155",label:"Fantom",fullName:"Fantom Opera",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00NjcgMTM1LjVjMTgtOS4zIDQ1LjEtOS4zIDYzIDBsMTgzLjQgOTdjMTAuNyA2LjEgMTYuNiAxNCAxOCAyMy4zdjQ4Ni42YzAgOS4zLTYuMSAxOS4yLTE4IDI1LjJsLTE4My4yIDk3Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTgzLjMtOTdjLTExLjktNi4xLTE3LjItMTUuOS0xOC0yNS4yVjI1NS43Yy43LTguNyA2LjctMTcuMiAxNy4yLTIzLjNMNDY3IDEzNS41em0yMzUuOCAzODkuNy0xNzIuNiA5MC45Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTcxLjktOTAuM3YyMTQuNGwxNzEuOSA5MC4zYzEwIDUuMyAyMC42IDEwLjcgMzEuMiAxMS4zaC43YzEwIDAgMjAtNS4zIDMwLjUtMTBsMTc0LTkyLjMtLjgtMjE0LjN6TTIzNy4zIDczMS4xYzAgMTguNiAyIDMxLjIgNi43IDM5LjggMy4zIDcuMyA4LjcgMTIuNiAxOC42IDE5LjJsLjcuN2MyIDEuNCA0LjcgMi42IDcuMyA0LjdsMy4zIDIgMTAuNyA2LjEtMTQuNiAyNC42LTExLjMtNy4zLTItMS40Yy0zLjMtMi02LjEtNC04LjctNS4zLTI3LjktMTguNi0zNy44LTM5LjItMzcuOC04MS42di0xLjRoMjcuMXpNNDg1IDM5Ni40Yy0xLjQuNy0yLjYuNy00IDEuNGwtMTgzLjIgOTYuOWgtLjcuN2wxODMuMyA5N2MxLjQuNyAyLjYgMS40IDQgMS40bC0uMS0xOTYuN3ptMjkuMyAwdjE5Ny44YzEuNC0uNyAyLjYtLjcgNC0xLjRsMTgzLjMtOTdoLjctLjdsLTE4My4zLTk4LjJjLTEuNC0uNS0yLjgtMS4yLTQtMS4yem0xODguNS0xMDctMTY0LjcgODYuMyAxNjQuNyA4Ni40VjI4OS40em0tNDA3LjcgMHYxNzMuM2wxNjQuNy04Ni4zLTE2NC43LTg3em0yMjIuNS0xMjhjLTkuMy01LjMtMjYuNS01LjMtMzYuNiAwbC0xODMuMiA5N2gtLjcuN2wxODMuMyA5N2M5LjMgNS4zIDI2LjUgNS4zIDM2LjYgMGwxODMuMy05N2guNy0uN2wtMTgzLjQtOTd6bTIxMi41IDkuMyAxMS4zIDcuMyAyIDEuNGMzLjMgMiA2LjEgNCA4LjcgNS4zIDI3LjkgMTguNiAzNy44IDM5LjIgMzcuOCA4MS42djEuNGgtMjguN2MwLTE4LjYtMi0zMS4yLTYuNy0zOS44LTMuMy03LjMtOC43LTEyLjYtMTguNi0xOS4ybC0uNy0uN2MtMi0xLjQtNC43LTIuNi03LjMtNC43bC0zLjMtMi0xMC43LTYuMSAxNi4yLTI0LjV6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#226efb",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iNDI1IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE5NjlmZiIvPjxwYXRoIGQ9Ik00NzQuMSAyMTAuM2MxNC4zLTcuNCAzNS45LTcuNCA1MC4yIDBsMTQ1LjkgNzcuMmM4LjUgNC44IDEzLjIgMTEuMSAxNC4zIDE4LjV2Mzg3LjVjMCA3LjQtNC44IDE1LjMtMTQuMyAyMC4xbC0xNDUuOSA3Ny4yYy0xNC4zIDcuNC0zNS45IDcuNC01MC4yIDBsLTE0NS45LTc3LjJjLTkuNS00LjgtMTMuNy0xMi43LTE0LjMtMjAuMVYzMDZjLjUtNi45IDUuMy0xMy43IDEzLjctMTguNS4xIDAgMTQ2LjUtNzcuMiAxNDYuNS03Ny4yem0xODcuNyAzMTAuM0w1MjQuMyA1OTNjLTE0LjMgNy40LTM1LjkgNy40LTUwLjIgMGwtMTM2LjktNzEuOXYxNzAuN2wxMzYuOSA3MS45YzcuOSA0LjIgMTYuNCA4LjUgMjQuOCA5aC41YzcuOSAwIDE1LjktNC4yIDI0LjMtNy45bDEzOC41LTczLjVWNTIwLjZoLS40ek0yOTEuMiA2ODQuNWMwIDE0LjggMS42IDI0LjggNS4zIDMxLjcgMi42IDUuOCA2LjkgMTAgMTQuOCAxNS4zbC41LjVjMS42IDEuMSAzLjcgMi4xIDUuOCAzLjdsMi42IDEuNiA4LjUgNC44LTExLjYgMTkuNi05LTUuOC0xLjYtMS4xYy0yLjYtMS42LTQuOC0zLjItNi45LTQuMi0yMi4yLTE0LjgtMzAuMS0zMS4yLTMwLjEtNjV2LTEuMWgyMS43em0xOTcuMi0yNjYuNGMtMS4xLjUtMi4xLjUtMy4yIDEuMWwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzEuMS41IDIuMSAxLjEgMy4yIDEuMVY0MTguMXptMjMuMiAwdjE1Ny41YzEuMS0uNSAyLjEtLjUgMy4yLTEuMWwxNDUuOS03Ny4yaC41LS41bC0xNDUuOS03OC4yYy0xLjEtLjUtMi4xLTEtMy4yLTF6TTY2MS44IDMzM2wtMTMxLjEgNjguNyAxMzEuMSA2OC43VjMzM3ptLTMyNC42IDB2MTM4bDEzMS4xLTY4LjdjMC0uMS0xMzEuMS02OS4zLTEzMS4xLTY5LjN6bTE3Ny4xLTEwMi4xYy03LjQtNC4yLTIxLjEtNC4yLTI5LjEgMGwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzcuNCA0LjIgMjEuMSA0LjIgMjkuMSAwbDE0NS45LTc3LjJoLjUtLjVsLTE0NS45LTc3LjJ6bTE2OS4xIDcuNCA5IDUuOCAxLjYgMS4xYzIuNiAxLjYgNC44IDMuMiA2LjkgNC4yIDIyLjIgMTQuOCAzMC4xIDMxLjIgMzAuMSA2NXYxLjFoLTIyLjdjMC0xNC44LTEuNi0yNC44LTUuMy0zMS43LTIuNi01LjgtNi45LTEwLTE0LjgtMTUuM2wtLjUtLjVjLTEuNi0xLjEtMy43LTIuMS01LjgtMy43bC0yLjYtMS42LTguNS00LjggMTIuNi0xOS42eiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",currency:{name:"Fantom",symbol:"FTM",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:yf},wrapped:{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",logo:mf},stables:{usd:["0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf","0x1B6382DBDEa11d97f24495C9A90b7c88469134a4"]},explorer:"https://ftmscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://ftmscan.com/tx/${t.id||t}`:e?`https://ftmscan.com/token/${e}`:n?`https://ftmscan.com/address/${n}`:void 0,endpoints:["https://rpc.ftm.tools","https://fantom.publicnode.com","https://rpc2.fantom.network"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"FTM",name:"Fantom",decimals:18,logo:yf,type:"NATIVE"},{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",symbol:"WFTM",name:"Wrapped Fantom",decimals:18,logo:mf,type:"20"},{address:"0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf",symbol:"lzUSDC",name:"LayerZero USDC",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"},{address:"0x1B6382DBDEa11d97f24495C9A90b7c88469134a4",symbol:"axlUSDC",name:"Axelar Wrapped USDC",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const vf="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/info/logo.png",wf="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/assets/0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270/logo.png";var bf={name:"polygon",id:"0x89",networkId:"137",namespace:"eip155",label:"Polygon (POS)",fullName:"Polygon (POS) Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMzEuNSA0NTkuM2MtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnYxOTQuNGMwIDE5LjIgOS42IDM2IDI0IDQzLjJsMTY1LjYgOTZjMTQuNCA5LjYgMzMuNiA5LjYgNDggMGwxNjUuNi05NmMxNC40LTkuNiAyNC0yNCAyNC00My4ydi02OS42bC03Ni44LTQzLjJ2NjQuOGMwIDE5LjItOS42IDM2LTI0IDQzLjJsLTg2LjQgNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtODYuNC01MC40Yy0xNC40LTkuNi0yNC0yNC0yNC00My4yVjU1MC41YzAtMTkuMiA5LjYtMzYgMjQtNDMuMmw4OC44LTUwLjRjMTQuNC05LjYgMzMuNi05LjYgNDggMGwxMTIuOCA2NC44IDc2LjggNDUuNiAxMTIuOCA2NC44YzE0LjQgOS42IDMzLjYgOS42IDQ4IDBsMTY4LTk2YzE0LjQtOS42IDI0LTI0IDI0LTQzLjJ2LTE5MmMwLTE0LjQtOS42LTMxLjItMjQtNDAuOGwtMTY4LTk2Yy0xNC40LTkuNi0zMy42LTkuNi00OCAwbC0xNjUuNiA5NmMtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnY2OS42bDc2LjggNDUuNnYtNjkuNmMwLTE5LjIgOS42LTM2IDI0LTQzLjJsODguOC01Mi44YzE0LjQtOS42IDMzLjYtOS42IDQ4IDBsODguOCA1MC40YzE0LjQgOS42IDI0IDI0IDI0IDQzLjJ2MTAwLjhjMCAxOS4yLTEyIDM2LTI0IDQzLjJsLTg4LjggNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtMTEyLjgtNjkuNi03OS4yLTQzLjItMTE3LjYtNjkuNmMtMTQuNC05LjYtMzMuNi05LjYtNDggMCAwIDIuNC0xNjAuOCA5OC40LTE2My4yIDk4LjR6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#824ee2",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMDkuNyA0NTljLTE2LjQgOS40LTI1LjggMjUuOC0yNS44IDQ2Ljl2MjA2LjNjMCAyMS4xIDkuNCAzNy41IDI1LjggNDYuOWwxNzUuOCAxMDMuMWMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBsMTc1LjgtMTAzLjFjMTYuNC05LjQgMjUuOC0yNS44IDI1LjgtNDYuOXYtNzIuN2wtODItNDYuOXY2OGMwIDIxLjEtOS40IDM3LjUtMjUuOCA0Ni45TDMzNyA3NjEuNGMtMTYuNCA5LjQtMzUuMiA5LjQtNTEuNiAwTDE5NCA3MDcuNWMtMTYuNC05LjQtMjUuOC0yNS44LTI1LjgtNDYuOVY1NTIuOGMwLTIxLjEgOS40LTM3LjUgMjUuOC00Ni45bDkzLjgtNTMuOWMxNC4xLTkuNCAzNS4yLTkuNCA1MS42IDBsMTE5LjUgNjggODIgNDkuMiAxMTkuNSA2OGMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBMODkwLjIgNTM0YzE2LjQtOS40IDI1LjgtMjUuOCAyNS44LTQ2LjlWMjgzLjJjMC0xNi40LTkuNC0zMi44LTI1LjgtNDIuMkw3MTIuMSAxMzcuOWMtMTYuNC05LjQtMzUuMi05LjQtNTEuNiAwTDQ4NC43IDI0MWMtMTYuNCA5LjQtMjUuOCAyNS44LTI1LjggNDYuOXY3NWw4MiA0OS4ydi03Mi43YzAtMjEuMSA5LjQtMzcuNSAyNS44LTQ2LjlsOTMuOC01Ni4zYzE2LjQtOS40IDM1LjItOS40IDUxLjYgMGw5My44IDUzLjljMTQuMSA5LjQgMjUuOCAyNS44IDI1LjggNDYuOXYxMDhjMCAyMS4xLTExLjcgMzcuNS0yNS44IDQ2LjlsLTkzLjggNTYuM2MtMTQuMSA5LjQtMzUuMiA5LjQtNTEuNiAwTDU0MSA0NzUuNGwtODItNDYuOS0xMjQuMi03Mi43Yy0xNC4xLTkuNC0zNS4yLTkuNC01MS42IDAtLjEuMS0xNzEuMiAxMDMuMi0xNzMuNSAxMDMuMnoiIGZpbGw9IiM4MjQ3ZTUiLz48L3N2Zz4=",currency:{name:"Polygon",symbol:"MATIC",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:vf},wrapped:{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",logo:wf},stables:{usd:["0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359","0xc2132D05D31c914a87C6611C10748AEb04B58e8F"]},explorer:"https://polygonscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://polygonscan.com/tx/${t.id||t}`:e?`https://polygonscan.com/token/${e}`:n?`https://polygonscan.com/address/${n}`:void 0,endpoints:["https://polygon-rpc.com","https://polygon.meowrpc.com","https://polygon-bor.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"MATIC",name:"Polygon",decimals:18,logo:vf,type:"NATIVE"},{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",symbol:"WMATIC",name:"Wrapped Matic",decimals:18,logo:wf,type:"20"},{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",type:"20"},{address:"0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xf6261529C6C2fBEB313aB25cDEcD243613b40EB5",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Mf="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDp1cmwoI1NWR0lEXzAwMDAwMDE5Njc2ODQzODE5NzI3MzAwODIwMDAwMDA1OTQ3NjMyODMzODYxMjM4OTE3Xyl9LnN0MntmaWxsOnVybCgjU1ZHSURfMDAwMDAwNjQzMjA1MjE4MTcxODM4NzM1NjAwMDAwMDMxNzkyNDIxNTkzMzkwODM5NjdfKX08L3N0eWxlPjxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfMV8iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iODE1Ljg1NiIgeTE9IjcwLjgyNCIgeDI9IjM4OC4zMzYiIHkyPSItNzQ4LjA1MiIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSA2NTcuOWM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDc5NS4xYy00LjkgNC45LTEyLjIgNy4zLTE3LjEgNy4zSDEyNS4zYy0xMi4yIDAtMTcuMS0xNC43LTkuOC0yNC41bDEyMi40LTEyMHoiIGZpbGw9InVybCgjU1ZHSURfMV8pIi8+PGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8wMDAwMDE1MDgxNTQ0MzI2NzI2OTc2MDQ0MDAwMDAxMzQ2MDgyNDM3MDQwMzE3MjU0M18iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iNjI4LjQ4MSIgeTE9IjE2NC4xMzQiIHgyPSIyMDAuOTYyIiB5Mj0iLTY1NC43NCIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSAyMDQuOGM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDM0MmMtNC45IDQuOS0xMi4yIDcuMy0xNy4xIDcuM0gxMjUuM2MtMTIuMiAwLTE3LjEtMTQuNy05LjgtMjJsMTIyLjQtMTIyLjV6IiBmaWxsPSJ1cmwoI1NWR0lEXzAwMDAwMTUwODE1NDQzMjY3MjY5NzYwNDQwMDAwMDEzNDYwODI0MzcwNDAzMTcyNTQzXykiLz48bGluZWFyR3JhZGllbnQgaWQ9IlNWR0lEXzAwMDAwMDA3NDA5ODc3MzYzMTA0OTgxNjMwMDAwMDE1MTMzNzA1NTcwNjgwMDk3NzA5XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI3MjAuOTIzIiB5MT0iMTE1Ljg3IiB4Mj0iMjkzLjQwNiIgeTI9Ii03MDMuMDAzIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMTkxLjQzNSkiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzAwZmZhMyIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2RjMWZmZiIvPjwvbGluZWFyR3JhZGllbnQ+PHBhdGggZD0iTTc2Mi4xIDQzMC4xYy00LjktNC45LTEyLjItNy4zLTE3LjEtNy4zSDEyNS4zYy0xMi4yIDAtMTcuMSAxNC43LTkuOCAyMkwyMzggNTY3LjNjNC45IDQuOSAxMi4yIDcuMyAxNy4xIDcuM2g2MTkuN2MxMi4yIDAgMTcuMS0xNC43IDkuOC0yMkw3NjIuMSA0MzAuMXoiIGZpbGw9InVybCgjU1ZHSURfMDAwMDAwMDc0MDk4NzczNjMxMDQ5ODE2MzAwMDAwMTUxMzM3MDU1NzA2ODAwOTc3MDlfKSIvPjwvc3ZnPgo=",Af="https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png";var Nf={name:"solana",networkId:"solana",namespace:"solana",label:"Solana",fullName:"Solana Mainnet Beta",logo:Mf,logoBackgroundColor:"#000000",logoWhiteBackground:Mf,currency:{name:"Solana",symbol:"SOL",decimals:9,address:"11111111111111111111111111111111",logo:Af},wrapped:{address:"So11111111111111111111111111111111111111112",logo:Af},stables:{usd:["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"]},explorer:"https://solscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://solscan.io/tx/${t.id||t}`:e?`https://solscan.io/token/${e}`:n?`https://solscan.io/address/${n}`:void 0,endpoints:["https://swr.xnftdata.com/rpc-proxy","https://solana-rpc.publicnode.com","https://mainnet-beta.solflare.network","https://endpoints.omniatech.io/v1/sol/mainnet/public"],sockets:["wss://solana.drpc.org","wss://mainnet-beta.solflare.network","wss://solana.a.exodus.io"],tokens:[{address:"11111111111111111111111111111111",symbol:"SOL",name:"Solana",decimals:9,logo:Af,type:"NATIVE"},{address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://img.raydium.io/icon/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v.png",type:"SPL"},{address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",symbol:"USDT",name:"USDT",decimals:6,logo:"https://img.raydium.io/icon/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB.png",type:"SPL"},{address:"7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj",symbol:"stSOL",name:"Lido Staked SOL",decimals:9,logo:"https://img.raydium.io/icon/7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj.png",type:"SPL"},{address:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",symbol:"BONK",name:"BONK",decimals:5,logo:"https://img.raydium.io/icon/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263.png",type:"SPL"},{address:"7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",symbol:"SAMO",name:"Samoyed Coin",decimals:9,logo:"https://img.raydium.io/icon/7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU.png",type:"SPL"},{address:"DePay1miDBPWXs6PVQrdC5Vch2jemgEPaiyXLNLLa2NF",symbol:"DEPAY",name:"DePay",decimals:9,logo:"https://depay.com/favicon.png",type:"SPL"}],zero:"0",maxInt:"340282366920938463463374607431768211455"};const If="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDojMjEzMTQ3fTwvc3R5bGU+PHBhdGggZD0iTTkyIDkyaDgxNnY4MTZIOTJWOTJ6IiBmaWxsPSJub25lIi8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTE2NS44IDM0MC4xVjY2MGMwIDIwLjYgMTAuOCAzOS4yIDI4LjcgNDkuNmwyNzcuMSAxNTkuOWMxNy42IDEwLjEgMzkuNSAxMC4xIDU3LjEgMGwyNzcuMS0xNTkuOWMxNy42LTEwLjEgMjguNy0yOSAyOC43LTQ5LjZWMzQwLjFjMC0yMC42LTEwLjgtMzkuMi0yOC43LTQ5LjZsLTI3Ny4xLTE2MGMtMTcuNi0xMC4xLTM5LjUtMTAuMS01Ny4xIDBsLTI3Ny4xIDE2MGMtMTcuNiAxMC4xLTI4LjQgMjktMjguNCA0OS42aC0uM3oiLz48cGF0aCBkPSJtNTYwLjQgNTYyLTM5LjUgMTA4LjRjLTEgMi45LTEgNi4yIDAgOS41bDY3LjkgMTg2LjQgNzguNi00NS40LTk0LjMtMjU4LjhjLTIuMy02LTEwLjQtNi0xMi43LS4xem03OS4zLTE4Mi4xYy0yLjMtNS45LTEwLjQtNS45LTEyLjcgMGwtMzkuNSAxMDguNGMtMSAyLjktMSA2LjIgMCA5LjVMNjk4LjggODAzbDc4LjYtNDUuNC0xMzcuNy0zNzcuNHYtLjN6IiBmaWxsPSIjMTJhYWZmIi8+PHBhdGggZD0iTTUwMCAxNDIuNmMyIDAgMy45LjYgNS41IDEuNmwyOTkuNiAxNzNjMy42IDIgNS41IDUuOSA1LjUgOS44djM0NmMwIDMuOS0yLjMgNy44LTUuNSA5LjhsLTI5OS42IDE3M2MtMS42IDEtMy42IDEuNi01LjUgMS42cy0zLjktLjYtNS41LTEuNmwtMjk5LjYtMTczYy0zLjYtMi01LjUtNS45LTUuNS05LjhWMzI2LjdjMC0zLjkgMi4zLTcuOCA1LjUtOS44bDI5OS42LTE3M2MxLjYtMSAzLjYtMS42IDUuNS0xLjZ2LjN6bTAtNTAuNmMtMTAuOCAwLTIxLjIgMi42LTMxIDguMmwtMjk5LjYgMTczYy0xOS4yIDExLjEtMzEgMzEuMy0zMSA1My41djM0NmMwIDIyLjIgMTEuOCA0Mi40IDMxIDUzLjVsMjk5LjYgMTczYzkuNSA1LjUgMjAuMiA4LjIgMzEgOC4yczIxLjItMi42IDMxLTguMmwyOTkuNi0xNzNjMTkuMi0xMS4xIDMxLTMxLjMgMzEtNTMuNXYtMzQ2YzAtMjIuMi0xMS44LTQyLjQtMzEtNTMuNWwtMjk5LjktMTczYy05LjUtNS41LTIwLjItOC4yLTMxLTguMmguM3oiIGZpbGw9IiM5ZGNjZWQiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJtMzAxLjUgODAzLjIgMjcuOC03NS43IDU1LjUgNDYtNTEuOSA0Ny43LTMxLjQtMTh6Ii8+PHBhdGggZD0iTTQ3NC41IDMwMi4yaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOEwyMjIuOSA3NTcuNWw3OC42IDQ1LjRMNDgxLjEgMzExYzEuNi00LjYtMS42LTkuMS02LjItOS4xbC0uNC4zem0xMzMuMiAwaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOGwtMTg2IDUwOS44IDc4LjYgNDUuNEw2MTMuOSAzMTFjMS42LTQuNi0xLjYtOS4xLTYuMi05LjF2LjN6IiBmaWxsPSIjZmZmIi8+PC9zdmc+Cg==";var Ef={name:"arbitrum",id:"0xa4b1",networkId:"42161",namespace:"eip155",platform:"evm",label:"Arbitrum",fullName:"Arbitrum One",logo:If,logoBackgroundColor:"#2b354d",logoWhiteBackground:If,currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:pf.currency.logo},wrapped:{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",logo:pf.wrapped.logo},stables:{usd:["0xaf88d065e77c8cC2239327C5EDb3A432268e5831","0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"]},explorer:"https://arbiscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://arbiscan.io/tx/${t.id||t}`:e?`https://arbiscan.io/token/${e}`:n?`https://arbiscan.io/address/${n}`:void 0,endpoints:["https://arbitrum.blockpi.network/v1/rpc/public","https://arbitrum-one.publicnode.com","https://endpoints.omniatech.io/v1/arbitrum/one/public"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:pf.currency.logo,type:"NATIVE"},{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:pf.wrapped.logo,type:"20"},{address:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8/logo.png",type:"20"},{address:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1/logo.png",type:"20"},{address:"0x912CE59144191C1204E64559FE8253a0e49E6548",symbol:"ARB",name:"Arbitrum",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0x912CE59144191C1204E64559FE8253a0e49E6548/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const xf="https://traderjoexyz.com/static/media/avalanche.7c81486190237e87e238c029fd746008.svg",kf="https://raw.githubusercontent.com/traderjoe-xyz/joe-tokenlists/main/logos/0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7/logo.png";var Tf={name:"avalanche",id:"0xa86a",networkId:"43114",namespace:"eip155",platform:"evm",label:"Avalanche",fullName:"Avalanche C-Chain",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0zNTkuMSA3NTEuMWgtOTUuM2MtMjAgMC0yOS45IDAtMzYtMy44LTYuNi00LjMtMTAuNC0xMS4zLTEwLjktMTguOS0uMy03LjEgNC42LTE1LjggMTQuNC0zM2wyMzUtNDE0LjNjMTAuMS0xNy42IDE1LjEtMjYuNCAyMS40LTI5LjYgNi45LTMuNSAxNS4xLTMuNSAyMS45IDAgNi40IDMuMyAxMS40IDEyIDIxLjQgMjkuNmw0OC40IDg0LjMuMi41YzEwLjggMTguOSAxNi4zIDI4LjUgMTguNiAzOC41IDIuNiAxMC45IDIuNiAyMi42IDAgMzMuNS0yLjQgMTAuMS03LjggMTkuOC0xOC44IDM4LjlMNDU2LjIgNjk0LjlsLS4zLjVjLTEwLjggMTktMTYuMyAyOC43LTI0LjEgMzYtOC4zIDgtMTguMyAxMy43LTI5LjMgMTYuOS05LjkgMi44LTIxLjEgMi44LTQzLjQgMi44em0yNDAuMyAwaDEzNi40YzIwLjIgMCAzMC4yIDAgMzYuMy00IDYuNi00LjMgMTAuNi0xMS4zIDEwLjktMTkuMS4zLTYuOS00LjUtMTUuMi0xMy45LTMxLjZsLTEtMS43TDY5OS44IDU3OGwtLjgtMS4yYy05LjYtMTYuMy0xNC40LTI0LjUtMjAuNy0yNy42LTYuOS0zLjYtMTUtMy42LTIxLjcgMC02LjIgMy4zLTExLjMgMTEuOC0yMS4zIDI5bC02OC4xIDExNi45LS4yLjNjLTEwLjEgMTcuMi0xNSAyNS44LTE0LjUgMzIuOC41IDcuNyA0LjUgMTQuOSAxMC45IDE5IDUuNyAzLjkgMTUuOCAzLjkgMzYgMy45eiIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#E84142",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yMzUuNiAyNTkuNWg1MjguOXY0ODFIMjM1LjZ2LTQ4MXoiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNOTI4IDUwMGMwIDIzNi40LTE5MS42IDQyOC00MjggNDI4UzcyIDczNi40IDcyIDUwMCAyNjMuNiA3MiA1MDAgNzJzNDI4IDE5MS42IDQyOCA0Mjh6TTM3OC43IDY3MC4zaC04My4xYy0xNy41IDAtMjYuMSAwLTMxLjMtMy40LTUuNy0zLjctOS4xLTkuOC05LjYtMTYuNS0uMy02LjIgNC0xMy44IDEyLjYtMjguOUw0NzIuNSAyNjBjOC43LTE1LjQgMTMuMS0yMyAxOC43LTI1LjkgNi0zIDEzLjEtMyAxOS4xIDAgNS42IDIuOCAxMCAxMC41IDE4LjcgMjUuOWw0Mi4yIDczLjYuMi40YzkuNCAxNi41IDE0LjIgMjQuOCAxNi4zIDMzLjYgMi4zIDkuNiAyLjMgMTkuNiAwIDI5LjItMi4xIDguOC02LjggMTcuMi0xNi40IDM0TDQ2My42IDYyMS4ybC0uMy41Yy05LjUgMTYuNi0xNC4zIDI1LTIxIDMxLjQtNy4zIDYuOS0xNiAxMi0yNS41IDE0LjgtOC43IDIuNC0xOC41IDIuNC0zOC4xIDIuNHptMjA5LjggMGgxMTljMTcuNiAwIDI2LjQgMCAzMS43LTMuNSA1LjctMy43IDkuMi05LjkgOS42LTE2LjYuMy02LTMuOS0xMy4zLTEyLjItMjcuNWwtLjktMS41LTU5LjYtMTAyLS43LTEuMWMtOC40LTE0LjItMTIuNi0yMS4zLTE4LTI0LjEtNi0zLTEzLjEtMy0xOSAwLTUuNSAyLjgtOS45IDEwLjMtMTguNiAyNS4zbC01OS40IDEwMi0uMi40Yy04LjcgMTUtMTMgMjIuNS0xMi43IDI4LjcuNCA2LjcgMy45IDEyLjkgOS42IDE2LjYgNSAzLjMgMTMuOCAzLjMgMzEuNCAzLjN6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2U4NDE0MiIvPjwvc3ZnPg==",currency:{name:"Avalanche",symbol:"AVAX",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:xf},wrapped:{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",logo:kf},stables:{usd:["0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7","0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"]},explorer:"https://snowtrace.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://snowtrace.io/tx/${t.id||t}`:e?`https://snowtrace.io/token/${e}`:n?`https://snowtrace.io/address/${n}`:void 0,endpoints:["https://avalanche.public-rpc.com","https://avalanche.blockpi.network/v1/rpc/public","https://avax.meowrpc.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"AVAX",name:"Avalanche",decimals:18,logo:xf,type:"NATIVE"},{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",symbol:"WAVAX",name:"Wrapped AVAX",decimals:18,logo:kf,type:"20"},{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7/logo.png",type:"20"},{address:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E/logo.png",type:"20"},{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xd586E7F844cEa2F87f50152665BCbc2C279D8d70/logo.png",type:"20"},{address:"0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Lf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAMAAAAKTh9YAAAAYFBMVEVHcEz////////////////////////////////////j++ma6qVj5nsl5lAK4zpA6mXO79aD8Zyr87uCvq0J2TkItEkOhl4EeVsKzSwLrxMNtQpjsZG42dEeuxyF2oU6wzjPwJjeAAAACnRSTlMAEUB9r9j/YO+Kf6/iMwAABD1JREFUeAHU1EESQjEMAlBIAq33v7ArV7+OLss7AZOB4IDVI/kW0nQRf+Ca7QvNwg/s7VtpGJP8oPFNybdT4aidoPHEcYZn6ymnEEOjH8KPk0zeTI+DLacpfMhpxKTGnFtDB9o8/Jisw8uxh1/OtGIrYw9Ah9pEOVWhnaoxTvWCnErR2Z3rzX59JMYOAkEYXr1gRJfIzP1PalbOpZm2aEf+tcKnCCz7bS37si/7si/7si/7si/7srvRHAE5kJHdbV4wkn076Q9RMMLu04fYnceT/An9JnhMkr19Ezwvvvee73ieOL1dfdN15yQlwas2S7vbgTn4iLfaDO0emIPPeLtgZt+AOfhcQHJGdieYg88VLG9k98AUfG7gBRu7YAo+9wpeNLEnYAY+915wkIndQ4Xn9IajgoV9hwbP6b3iqGRhF5zH537VHi3swGl87tft3tB+Ap/7Z9lFhef0z3hndmjwnP4Z32qEAs/po4//Rwao8JzeC3hiMyeACs/ppnMCUlThOf3wxjurObAKz+kHNz5arT0CNHhO5zde7NZ8UYXn9N4K2Utnt8NzOsFL+Kuz2+EJneA5nduN8bmTWsXzKqNzuyX+FZ3rL43Sud0Un/txtV7KqNY+6Hq7Kb71Gxt0W7seX5od/Z6a+8BuGASCMMwraRK4103A9z9leq+Q3zCYC+h7oy7tbr6d4zGd2zme04Ed4AEd2AEe0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2Tl+B+jQzvH7j/ThnNub4Xd7Rud2gLc9pyM7wO9sz+nEDvA7e8G/0vX2IeTan/DXPdWL+cwD/hl/c3r2lT2u7XbWk31aYt9vesp9yD5Xn1ZPx7svtNtMYwfX9/hqjwAvuq8awIufZwzgxc+RZgAvfn43gBe/N5lxPLAD+sTs2HgnS53jnS51jHfC1CneKVOHeCdNneGdNnWEd+LUCd6pUwd4p04d4J06dYB3tekAL64nSAAvr+PgeGYHdI6ndkDneGoHdI4HdkAvxw/V7IsiegU8sIdSejk+VbIvyumveBY8twdQh51A8PL691x8PBf3HRD8oO33QPhR2mfD8EnZ3wTxXthXRvFe18+H8anbPsqkOVfnnJ6DF/RmPdE5vs69aQiYnoH3rXuzXukcP6jmE3C8734uxAgfgSvM4+D4RcV37SmgZ+BT6/kz0yd6KT5+kcex9bel+fDPupXP+MOs8byl6esGYfRxbDPnanG0OVf+8ODeH9Ks5f+mE50vJlp37d23EQQhFATRr6Yg/4RPuSe9o6tmIni7gN2222677bbbbrvttttuu5sw/7EP1j7kfhO6m5Wbak90Jw7d54NeGsV9jb0y1B+f+P5qpHB08XvD8M4zrq9N7pqje/L8jj/twXa8XOl4uSoe4/363RnvlyOo/LE1R8JnZfywrB7pGLY0Xa/gV5AhY9e5oJHCAAAAAElFTkSuQmCC",Sf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAYAAAA9kO9qAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0PSURBVHgB7d1LbFzVHcfx37l3/CDGxgkhxEnU2K1EgxoUN0kVUglhIhbdVAo7dpCiSl2BqbqphIRpuy5u95SwY1XSWlXVIhFXtGqjJsXQSJRCsXklaQiJ8zCxPTP3cv53cuOxZ8bjmbmP8z/n/5GMHcfjmPHXZ86ce++xQpJGxwdRwChCtQ9Q+nU4qt87CIVhCLGeEHP6v/NQag5h8DY8TKOEGcxMziMhCp2iwD0c1V/kE/QnUNxCJGdavxzHmRdfQYfajz2K3HsGKhyHBC7SN6dznUY5eEGP9nNoQ+uxS+Qib6GawL9++QJa1FrsB8fH9D/0sn5rGELka04PuMdwenJ6ozfwN/qB2D/+vP7ZOA4ZzYUZdIfqSQx9Fzj/979s5AbNR3aatvieHs3DoxDCSOqEnssfa7Zys37s0VKiOqmXhUYhhMlCvUwZhI+sF3zj2CV0wU2T4L2GN6Spi4QuOFG612jKXV/9J6j0ZFThRxCCnz2NnrTWTmMqy4snIQRnSk9n1ixL1k5jKuvoQvBGHdPzziqrY4/W0uWAkbDCMDw1Xv2OlWnM6PgwfDULIewxj3I4Eq/OrIzsvpqAEHYZrB7dq6cxD0MI2yg8E8/dK7HvH38SMlcXdqpcb4E49sqFF0LY6VbfqnKil7oCIewVPVH1omtGhbBbdG20hwBjEMJ2AcWuvH0QwnYK+zyE4TCEsF2oaGSXy+yEA3TntPQ4DCHsN+xBCEdI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwRgEWU30loK9c+cOCj3DB6v/dtqltS7ffDi/2wFZWffcpbv/IJXh7r8Hfe70SexWKPZjdhPKpzdGLzd/Y9dD9Uzh0BR69VIUeo/somO1D6c0tCN6y50I2hQPPhmCORqauxz9D4cjnLd2u9MY9KL6605noC9+/EN1PaweB9dB9Q/cR3VfcsY+9nW/gWsWpIRRf+hpspUa+RM/T/4OnX7eLol987n7WAwPb2Cnurqdn9cPxZSTBhm9mPfRo1/XUxx0NBtWWX9qN0tR2cMRyNYa+cT2/eDex0KPPqadCvfpzqjpzWK4Kj51D99MfJhY66X7qo+jRlCOWsdNI1clDciM2Be8/9AW6n/gEaaDg6UkuN+xip1Gl1SeirbAheH/0Krp/OIc09fz0v4k+YmSBVewUYBYPoZyD976xgMLjn0INpBui0scv6BGWE1ax06qLl1GAHIOn0D09qvt7biAL9Airdic/nUwLq9iznidyCj4KXb/438l2q/2uR9ObUiaNTex+g6N9aeMQfBx69PaORWTJPyKxJ45iz4vJwVeHrrYupz5XX4vm7mpkARywiT3v0EwMvjr0SH8RefBHeMzb2cTuGXCHmhR8Tej0Pj2y54HLk3g+I7sha7omBF8v9EhPgDxI7BbLM/iGoedpyQcHbGIPDDtBK4/gm4a+lM+3M7zK47IINrGbeDZilsFvZEQPr3UhD3ShBwd8Yp/dBBNlEfxGpy7huV7kIfjkDnDAJvbSqc0wVZrBtzJHD68X9Oie7ZSCHnHz+iFrFZ85+9kBoy+YTiP4dp6MBu/diSwV/3gvuGC1GlOaMvuOTTL4dlddyu/chTDDJ6rlv20BF8xiHzJuVWatJILvaHlRhx68M4AsFF/dxeoyRlaxhws+ln/9dZiuk+CTWEePRveU5+7xrgOcsDuoRHN3DndyO8EndsBIj+6l3w2lNp2h5050cTo3LI+g0sOnbcEnfWSUVmZKJ5IPPg6d4y4MPnYcngBDNMIT2vnLZHQKLO2+RTuQocFqUmqnANz0EX5wZ3QSnUrgvJnwcjcWJ/YYe8yjGbaxExuCT/1cl2VPx9kXxa46OCuy/O8BLP38Pr2mzuMAUj2sYyecg8/spC4dPB3SD/7T33L0wWe9KP15G5Z/sxuY7wZnVuz1SLoe/zS6INt08c5jqr+U29mL9G+rHYt6erMQnRZMf7799ekfDFzqRqBfwvf6EdzwUT6tf0Cv898D15rYCZvg9dy3+Id7jQ8oLCprQidWnc/OZpVmyzK6jp4H+s3dZMi20Il1F2+wCV6HbmrwNoZOrLxSSYJvn62hE2svy5PgW2dz6MTqa1Al+I2zPXRi/QXXEnxzLoROnNhdQIJvzJXQiTNbaUjwtVwKnTi1b4wEv8K10IlzmyRJ8G6GTpzcEczl4F0NnTi7/R234NWmzi/idjl04vRej6yCf/R9qJ4OfmnvTc/p0InzG5tyCR67+tB94FRbwUvoFbKLL3gF3/PAmy0Ffzv0mzx22k2TxH4Lh+DDzVug+pY2HLyEvprEXsX44H0fwcBdUL1fNg1eQq8lsa9BwZemtsNYd1QueG4WvIReS2KvI9rWzdRNVLtXLnpuFHxAu+pK6DUk9jpom73gbD9MFPau3sqiXvDhZzy2kM6axN4ABc9FTfBlBVFLYm9Abcvn1yw2VS7Xffft4PuuAr35/NY800nsddDejP7eazBSg9hJHLw/fBGilsReh8l7z6jFm+v/faGI3u+9Dm/7FxCrSexr0EZLhSOfw1Tqxo3mH6OD3/SD30vwa0jsVTjsKKYWmscefVzvsgS/hsR+C4vQr1xed85e8/ES/CoSO/jsEen9/wJaJcGvcD52LqGrS/p5xHJ7y6ESfIXTsXMJnSL3znX2dUrwDsfOKXT/ww+QBNeDdzJ2dqEvJ3c01+XgnYvd5dBjrgbvVOwS+goXg3cmdgm9lmvBOxG7hN6YS8FbH7uE3pwrwVsdu4S+cS4Eb23sEnrrbA/eytgl9PbZHLx1sUvonbM1eKtiZ/Mbrq8pY0OP2Ri8NbGzCf1iDxZ/sg9Lf3oAprMteCtiZxX6c/dHr5dPHsTSyQMwnU3Bs4+dY+gxCT5brGPnHHpMgs8O29htCD0mwWeDZew2hR7jFrwavA5u2MVeOHTZutBjvIKf0q87/6VmWeIX+1Mfw3TthB7jErynR/auw2fBCavYaacub5vZo0knoce4BN99+B1Wozuv2A2fviQReoxD8DSd4TS6s4nd23vN6FE9ydBjHILv+vZ74IJN7IVDV2CqNEKPmR48zd25rMywiV2NtP/bndOUZugx04P3R86BAz6xGziFySL0mMnBezKyJ8u0+XqWocdMDd7r57EiI7v4tiGP0GNcliVNxCZ2U34vaZ6hx0wLPrie333RCj6xX+xG3kwIPWZS8MH8ZnDAJvbg7ADyZFLoMVOCD84PggM2sZdO5Td6mBh6LO/gg/l+BBfuBgd8pjGzfbnM200OPZZn8OXZIXDB6Amqj9LUvcgSh9BjeQW/pP9dLlgtPZamhjIb3TmFHss6+OJb9yHU0xguWMVOo3vx1R1IG8fQYxT84m/HkDaaq3Ma1Qm7g0o0upfeuAdp4Rx6rDjzzdSDX5p6mNWoTlgeQS2+tBvB7CYkzYbQY2kGv/j6gyi9vxPc+NhxeALcFD2U/7oVatdNeLsWkQT64Vn62R4rQo8FF7YivNIPf+Q8VGHjvxm7kXCxR4/oD6F46lvgSOHAsyEYS2KngdLUdv1cYKcxpyQkjc5KvOPYFLzN7Z+dGJy/Gzdfe4TNmno97GMndPovRV84cqml25X1UVmKPO+js1mhq4q6x860FD09EV1+cz+K/9wD7qyIPUbR0+V7/qEr8Pdeh+orrfp7GrlpulLWR2PLb2y1diRvxh8+F4VPmx35Q6s3PApLXQg+H0B5Ti8EvDuiX6e/+pUVq2Kv5/ZFH3rZ0tW4m4l2COitbJ/NbYWlFdZ/9216wpkWeuKJRfvvJ7l4QzhDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyj2OQhhvzkPIeYhhO105zr28G0IYTsVfuRBYQZC2C7EjKdn7RK7sJ+HaQ+lKHaZtwu7lWhkn5mk0GV0Fzabps4r6+xh+AqEsNdx+k8l9gAnIFMZYaNQH0c682I0mFdip6lMGP4KQthGhdPxmyunCwSYhIzuwjZlvBC/uRK7jO7CNkqHPjM5F/9x9YlgNLqHcq6MsAB1fPrFiep3rY6dRncvPAYhuKvTsV/zQef+MYedDyr9GDAGITii6cvpyeO1727kwI9f048FRyEEK+EJnJl8rN7fNL54oxwco5NnIAQX1GsZDafhat0bj44PwlMn9UeNQgiTUehB+Mit01/qWv+yPLohfQKoExDCWHrq0iR0sv7IXu3g+ARC9TyEMEn0ZHT1EmPjD23FwfExBOplfathCJEnWken5cXTk9MbvUlrscdklBd5oWumPX2kv6QPgDaZtqzVXuxkdHwYvtLR42EZ6UXqOog81n7s1faPP6k/0xNyIEokigJX4Yx+/Up0GnqbkceSiT1GS5UFvUwZYEx/5n36ixzW/8SgjPyiqeicrHC+sgGAmtGRvx1dMtph4NW+AiZycfiu2QTRAAAAAElFTkSuQmCC";var jf={name:"gnosis",id:"0x64",networkId:"100",namespace:"eip155",label:"Gnosis",fullName:"Gnosis Chain",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojZmZmfTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMzMS45IDU1Ni41YzIzLjUgMCA0Ni40LTcuOCA2NS0yMi4yTDI0OCAzODUuNGMtMzUuOSA0Ni40LTI3LjQgMTEyLjkgMTguOSAxNDguOCAxOC42IDE0IDQxLjUgMjEuOSA2NSAyMS45di40em00NDIuMy0xMDYuMWMwLTIzLjUtNy44LTQ2LjQtMjIuMi02NUw2MDMuMiA1MzQuMmM0Ni40IDM1LjkgMTEyLjkgMjcuNCAxNDguOC0xOC45IDE0LjMtMTguNiAyMi4yLTQxLjQgMjIuMi02NC45eiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im04NDkuMiAyODguNS02NS45IDY1LjljNTIuOSA2My42IDQ0LjcgMTU4LTE4LjkgMjExLjItNTUuNiA0Ni43LTEzNi42IDQ2LjctMTkyLjIgMEw1MDAgNjM3LjdsLTcyLjEtNzIuMWMtNjMuNiA1Mi45LTE1OCA0NC43LTIxMS4yLTE4LjktNDYuNy01NS42LTQ2LjctMTM2LjYgMC0xOTIuMmwtMzMuNi0zMy42LTMyLTMyLjNDMTEyLjMgMzUyLjIgOTIgNDI1LjMgOTIgNTAwYzAgMjI1LjIgMTgyLjggNDA4IDQwOCA0MDhzNDA4LTE4Mi44IDQwOC00MDhjLjMtNzQuNC0yMC42LTE0Ny44LTU4LjgtMjExLjV6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTc5NS4xIDIxOC4zYy0xNTUuNC0xNjIuOC00MTMuNi0xNjktNTc2LjQtMTMuNy00LjkgNC42LTkuNSA5LjEtMTMuNyAxMy43LTEwLjEgMTAuOC0xOS42IDIxLjktMjguNyAzMy4zTDUwMCA1NzUuNGwzMjMuOC0zMjMuOGMtOC44LTExLjctMTguNi0yMi44LTI4LjctMzMuM3pNNTAwIDE0NS4yYzk1LjMgMCAxODQuMSAzNi45IDI1MSAxMDMuOEw1MDAgNTAwIDI0OSAyNDljNjYuNi02Ny4yIDE1NS43LTEwMy44IDI1MS0xMDMuOHoiLz48L3N2Zz4K",logoBackgroundColor:"#406958",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojM2U2OTU3fTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMyNC4yIDU1OS4xYzI0LjYgMCA0OC41LTguMiA2Ny45LTIzLjJMMjM2LjUgMzgwLjJjLTM3LjUgNDguNS0yOC43IDExOC4xIDE5LjggMTU1LjYgMTkuNSAxNC43IDQzLjMgMjIuOSA2Ny45IDIyLjl2LjR6TTc4Ni43IDQ0OC4xYzAtMjQuNi04LjItNDguNS0yMy4yLTY3LjlMNjA3LjkgNTM1LjhjNDguNSAzNy41IDExOC4xIDI4LjcgMTU1LjYtMTkuOCAxNS0xOS40IDIzLjItNDMuMyAyMy4yLTY3Ljl6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0ibTg2NS4yIDI3OC44LTY4LjkgNjguOWM1NS4zIDY2LjYgNDYuOCAxNjUuMi0xOS44IDIyMC44LTU4LjQgNDguOC0xNDIuNyA0OC44LTIwMSAwTDUwMCA2NDRsLTc1LjQtNzUuNGMtNjYuNiA1NS4zLTE2NS4yIDQ2LjgtMjIwLjgtMTkuOC00OC44LTU4LjQtNDguOC0xNDIuNyAwLTIwMWwtMzUuMi0zNS4yLTMzLjQtMzMuOGMtNDAuNiA2Ni42LTYxLjggMTQzLTYxLjggMjIxLjIgMCAyMzUuNSAxOTEuMSA0MjYuNiA0MjYuNiA0MjYuNlM5MjYuNiA3MzUuNSA5MjYuNiA1MDBjLjQtNzcuOC0yMS41LTE1NC42LTYxLjQtMjIxLjJ6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTgwOC42IDIwNS41QzY0Ni4xIDM1LjEgMzc2LjEgMjguNyAyMDUuOCAxOTEuMWMtNS4xIDQuOC05LjkgOS42LTE0LjMgMTQuMy0xMC42IDExLjMtMjAuNSAyMi45LTMwIDM0LjhMNTAwIDU3OC44bDMzOC42LTMzOC42Yy05LjItMTIuMi0xOS41LTIzLjgtMzAtMzQuN3pNNTAwIDEyOWM5OS43IDAgMTkyLjUgMzguNiAyNjIuNSAxMDguNUw1MDAgNTAwIDIzNy41IDIzNy41QzMwNy4yIDE2Ny4yIDQwMC4zIDEyOSA1MDAgMTI5eiIvPjwvc3ZnPgo=",currency:{name:"xDAI",symbol:"xDAI",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Lf},wrapped:{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",logo:Sf},stables:{usd:["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"]},explorer:"https://gnosisscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://gnosisscan.io/tx/${t.id||t}`:e?`https://gnosisscan.io/token/${e}`:n?`https://gnosisscan.io/address/${n}`:void 0,endpoints:["https://rpc.gnosis.gateway.fm","https://rpc.gnosischain.com","https://gnosis.blockpi.network/v1/rpc/public"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"xDAI",name:"xDAI",decimals:18,logo:Lf,type:"NATIVE"},{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",symbol:"WXDAI",name:"Wrapped XDAI",decimals:18,logo:Sf,type:"20"},{address:"0x4ECaBa5870353805a9F068101A40E0f32ed605C6",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb",symbol:"GNO",name:"Gnosis",decimals:18,logo:"https://cdn.sushi.com/image/upload/f_auto,c_limit,w_16,q_auto/tokens/100/0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb.jpg",type:"20"},{address:"0xD057604A14982FE8D88c5fC25Aac3267eA142a08",symbol:"HOPR",name:"HOPR",decimals:18,logo:"https://hoprnet.org/assets/icons/hopr_icon.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"},Cf={name:"optimism",id:"0xa",networkId:"10",namespace:"eip155",label:"Optimism",fullName:"Optimism",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00ODcuMSAzOTUuN2MtNS4yLTE1LjgtMTMuMi0zMS43LTI2LjQtNDIuMi0xMy4yLTEwLjUtMjYuNC0yMS4yLTQ0LjktMjYuNC0xOC41LTUuMi0zNy04LTU4LjEtOC00Ny41IDAtODcuMSAxMC41LTExNi4xIDM0LjQtMjkgMjMuOC00Ny41IDU4LjEtNjAuNyAxMDIuOS0yLjYgMTUuOC04IDI5LTEwLjUgNDQuOS0yLjYgMTMuMi01LjIgMjktOCA0Mi4yLTIuNiAyMy44LTIuNiA0Mi4yIDIuNiA2MC43IDUuMiAxNS44IDEzLjIgMzEuNyAyNi40IDQyLjIgMTMuMiAxMC41IDI2LjQgMjEuMiA0NC45IDI2LjQgMTguNCA1LjIgMzcgOCA1OC4xIDggNDcuNSAwIDg3LjEtMTAuNSAxMTYuMS0zNC40czQ3LjUtNTguMSA2MC43LTEwMi45YzIuNi0xMy4yIDUuMi0yOSAxMC41LTQyLjIgMi42LTEzLjIgNS4yLTI5IDgtNDQuOSAyLjgtMjMuOCAyLjgtNDQuOC0yLjYtNjAuN3ptLTkyLjQgNjAuOGMtMi42IDEzLjItNS4yIDI2LjQtOCAzOS41LTIuNiAxMy4yLTUuMiAyNi40LTEwLjUgNDIuMi01LjIgMjMuOC0xNS44IDM5LjUtMjkgNTAuMi0xMy4yIDEwLjUtMjkgMTUuOC00Ny41IDE1LjgtMTguNCAwLTMxLjctNS4yLTM5LjUtMTUuOC04LTEwLjUtMTAuNS0yOS01LjItNTAuMiAyLjYtMTUuOCA1LjItMjkgOC00Mi4yIDIuNi0xMy4yIDUuMi0yNi40IDEwLjUtMzkuNSA1LjItMjMuOCAxNS44LTM5LjUgMjktNTAuMiAxMy4yLTEwLjUgMjktMTUuOCA0Ny41LTE1LjggMTguNCAwIDMxLjcgNS4yIDM5LjUgMTUuOCA3LjkgMTAuNiAxMC41IDI2LjMgNS4yIDUwLjJ6bTQ0MC45LTY4LjZjLTUuMi0xNS44LTEzLjItMjYuNC0yMy44LTM3cy0yMy44LTE1LjgtNDIuMi0yMS4yYy0xNS44LTUuMi0zNC40LTgtNTUuNC04SDU3OS43Yy0yLjYgMC01LjIgMC0xMC41IDIuNi0yLjYgMi42LTUuMiA1LjItNS4yIDhsLTY4LjYgMzI3LjRjMCAyLjYgMCA4IDIuNiA4IDIuNiAyLjYgNS4yIDIuNiA4IDIuNmg2OC42YzIuNiAwIDggMCAxMC41LTIuNnM1LjItNS4yIDUuMi04bDIzLjgtMTEwLjloNjguNmM0Mi4yIDAgNzYuNi04IDEwMi45LTI2LjQgMjYuNC0xOC40IDQyLjItNDcuNSA1MC4yLTg0LjYgNS4xLTE4LjQgNS4xLTM2LjctLjItNDkuOXpNNzQzLjEgNDM4Yy0yLjYgMTUuOC0xMC41IDI2LjQtMjEuMiAzNC40cy0yMy44IDEwLjUtMzcgMTAuNWgtNTguMWwxOC40LTg5LjdoNjAuN2MxMy4yIDAgMjEuMiAyLjYgMjYuNCA1LjIgNS4yIDUuMiAxMC41IDEwLjUgMTAuNSAxNS44IDMgNS4yIDMgMTMuMi4zIDIzLjh6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",logoBackgroundColor:"#FF0420",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iMzk2LjYiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNNTAwIDg5Ni42YzIxOS4xIDAgMzk2LjYtMTc3LjYgMzk2LjYtMzk2LjZTNzE5LjEgMTAzLjQgNTAwIDEwMy40IDEwMy40IDI4MC45IDEwMy40IDUwMCAyODAuOSA4OTYuNiA1MDAgODk2LjZ6TTM1MC43IDYwOWMxMC45IDMuNCAyMi42IDUuMSAzNS4zIDUuMSAyOS4xIDAgNTIuNC02LjcgNjkuNi0yMC4yIDE3LjMtMTMuNyAyOS4zLTM0LjMgMzYuMi02MS44IDItOC42IDMuOS0xNy4zIDUuNy0yNS45IDItOC42IDMuNy0xNy40IDUuMS0yNi4yIDIuNC0xMy43IDItMjUuNi0xLjItMzUuOS0zLTEwLjItOC4zLTE4LjktMTYtMjUuOS03LjQtNy0xNi42LTEyLjMtMjcuNC0xNS43LTEwLjctMy42LTIyLjMtNS40LTM1LTUuNC0yOS4zIDAtNTIuNyA3LTY5LjkgMjEuMXMtMjkuMiAzNC43LTM1LjkgNjEuOGMtMiA4LjgtNCAxNy42LTYgMjYuMi0xLjggOC42LTMuNSAxNy4zLTUuMSAyNS45LTIuMiAxMy43LTEuOCAyNS42IDEuMiAzNS45IDMuMiAxMC4yIDguNSAxOC44IDE2IDI1LjYgNy40IDYuOCAxNi42IDExLjkgMjcuNCAxNS40em02Ny44LTQ4Yy04LjIgNi40LTE3LjggOS42LTI4LjYgOS42LTExLjEgMC0xOS0zLjItMjMuOC05LjYtNC44LTYuNC02LTE2LjctMy42LTMwLjcgMS42LTguOCAzLjItMTcuMiA0LjgtMjUgMS44LTcuOCAzLjgtMTYgNi0yNC40IDMuNC0xNC4xIDkuMS0yNC4zIDE3LjItMzAuNyA4LjItNi40IDE3LjgtOS42IDI4LjYtOS42czE4LjggMy4yIDIzLjggOS42IDYuMiAxNi43IDMuNiAzMC43Yy0xLjQgOC40LTMgMTYuNi00LjggMjQuNC0xLjYgNy44LTMuNSAxNi4yLTUuNyAyNS0zLjQgMTQtOS4yIDI0LjMtMTcuNSAzMC43em05MS43IDQ4YzEuMiAxLjQgMi44IDIuMSA0LjggMi4xaDQxYzIuMiAwIDQuMS0uNyA1LjctMi4xIDEuOC0xLjQgMi45LTMuMiAzLjMtNS40bDEzLjktNjZoNDAuN2MyNS45IDAgNDYuNS01LjUgNjEuOC0xNi42IDE1LjUtMTEuMSAyNS43LTI4LjEgMzAuNy01MS4yIDIuNC0xMS43IDIuMy0yMS44LS4zLTMwLjQtMi42LTguOC03LjItMTYuMi0xMy45LTIyLTYuNi01LjgtMTUtMTAuMS0yNS0xMy05LjgtMi44LTIwLjktNC4yLTMzLjItNC4yaC04MC4yYy0yIDAtMy45LjctNS43IDIuMS0xLjggMS40LTIuOSAzLjItMy4zIDUuNEw1MDkgNjAzLjVjLS40IDIuMiAwIDQgMS4yIDUuNXptMTExLjItMTEzLjFoLTM0LjdsMTEuOC01NGgzNi4yYzcuMiAwIDEyLjYgMS4yIDE2IDMuNiAzLjYgMi40IDUuNyA1LjYgNi4zIDkuNi42IDQgLjQgOC42LS42IDEzLjktMiA5LTYuMyAxNS44LTEzIDIwLjItNi40IDQuNS0xMy44IDYuNy0yMiA2Ljd6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmMDQyMCIvPjwvc3ZnPg==",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:pf.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:pf.wrapped.logo},stables:{usd:["0x94b008aA00579c1307B0EF2c499aD98a8ce58e58","0x7F5c764cBc14f9669B88837ca1490cCa17c31607"]},explorer:"https://optimistic.etherscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://optimistic.etherscan.io/tx/${t.id||t}`:e?`https://optimistic.etherscan.io/token/${e}`:n?`https://optimistic.etherscan.io/address/${n}`:void 0,endpoints:["https://optimism.blockpi.network/v1/rpc/public","https://optimism.meowrpc.com","https://optimism.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:pf.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:pf.wrapped.logo,type:"20"},{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x94b008aA00579c1307B0EF2c499aD98a8ce58e58/logo.png",type:"20"},{address:"0x7F5c764cBc14f9669B88837ca1490cCa17c31607",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x7F5c764cBc14f9669B88837ca1490cCa17c31607/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x4200000000000000000000000000000000000042",symbol:"OP",name:"Optimism",decimals:18,logo:"https://user-images.githubusercontent.com/1300064/219575413-d7990d69-1d21-44ef-a2b1-e9c682c79802.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"},Df={name:"base",id:"0x2105",networkId:"8453",namespace:"eip155",label:"Base",fullName:"Base",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguNiA4NDJDNjg4IDg0MiA4NDIgNjg4LjkgODQyIDQ5OS41UzY4OCAxNTcgNDk4LjYgMTU3QzMxOSAxNTcgMTcxLjIgMjk1LjEgMTU3IDQ3MC4zaDQ1My4xdjU3LjVIMTU3QzE3MiA3MDMuOSAzMTkgODQyIDQ5OC42IDg0MnoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#0052FF",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguOSA4NDVDNjkwLjEgODQ1IDg0NSA2OTAuMyA4NDUgNDk5LjVTNjkwLjEgMTU0IDQ5OC45IDE1NEMzMTcuNiAxNTQgMTY4LjggMjkzLjMgMTU0IDQ3MC41aDQ1Ny40djU4LjFIMTU0QzE2OC44IDcwNS44IDMxNy42IDg0NSA0OTguOSA4NDV6IiBmaWxsPSIjMDA1MmZmIi8+PC9zdmc+",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:pf.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:pf.wrapped.logo},stables:{usd:["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA"]},explorer:"https://basescan.org",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://basescan.org/tx/${t.id||t}`:e?`https://basescan.org/token/${e}`:n?`https://basescan.org/address/${n}`:void 0,endpoints:["https://base.blockpi.network/v1/rpc/public","https://base.meowrpc.com","https://mainnet.base.org"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:pf.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:pf.wrapped.logo,type:"20"},{address:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA",symbol:"USDbC",name:"USD Base Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Of=[pf,hf,bf,Nf,gf,Ef,Tf,jf,Cf,Df];var zf={ethereum:pf,bsc:hf,polygon:bf,solana:Nf,fantom:gf,arbitrum:Ef,avalanche:Tf,gnosis:jf,optimism:Cf,base:Df,all:Of,findById:function(t){let e=t;return e.match("0x0")&&(e=e.replace(/0x0+/,"0x")),Of.find((t=>t.id&&t.id.toLowerCase()==e.toLowerCase()))},findByNetworkId:function(t){return t=t.toString(),Of.find((e=>e.networkId==t))},findByName:function(t){return Of.find((e=>e.name==t))}},Pf="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _f(t){var e={exports:{}};return t(e,e.exports),e.exports}for(var Bf=[],Rf=[],Uf="undefined"!=typeof Uint8Array?Uint8Array:Array,Qf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yf=0,Wf=Qf.length;Yf0)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 Vf(t,e,n){for(var r,i,o=[],a=e;a>18&63]+Bf[i>>12&63]+Bf[i>>6&63]+Bf[63&i]);return o.join("")}Rf["-".charCodeAt(0)]=62,Rf["_".charCodeAt(0)]=63;var Hf=function(t){var e,n,r=Ff(t),i=r[0],o=r[1],a=new Uf(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),s=0,u=o>0?i-4:i;for(n=0;n>16&255,a[s++]=e>>8&255,a[s++]=255&e;return 2===o&&(e=Rf[t.charCodeAt(n)]<<2|Rf[t.charCodeAt(n+1)]>>4,a[s++]=255&e),1===o&&(e=Rf[t.charCodeAt(n)]<<10|Rf[t.charCodeAt(n+1)]<<4|Rf[t.charCodeAt(n+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e),a},Gf=function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,a=0,s=n-r;as?s:a+o));return 1===r?(e=t[n-1],i.push(Bf[e>>2]+Bf[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(Bf[e>>10]+Bf[e>>4&63]+Bf[e<<2&63]+"=")),i.join("")},qf=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},Zf=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;t[n+f]=255&a,f+=p,a/=256,c-=8);t[n+f-p]|=128*y},Jf=_f((function(t,e){const n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){return+t!=t&&(t=0),o.alloc(+t)},e.INSPECT_MAX_BYTES=50;const r=2147483647;function i(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|d(t,e);let r=i(n);const a=r.write(t,e);return a!==n&&(r=r.slice(0,a)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(H(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(H(t,ArrayBuffer)||t&&H(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(H(t,SharedArrayBuffer)||t&&H(t.buffer,SharedArrayBuffer)))return l(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return o.from(r,e,n);const a=function(t){if(o.isBuffer(t)){const e=0|h(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||G(t.length)?i(0):c(t):"Buffer"===t.type&&Array.isArray(t.data)?c(t.data):void 0}(t);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return s(t),i(t<0?0:0|h(t))}function c(t){const e=t.length<0?0:0|h(t.length),n=i(e);for(let r=0;r=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function d(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||H(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(t).length;default:if(i)return r?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function f(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,n);case"utf8":case"utf-8":return N(this,e,n);case"ascii":return E(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function p(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:m(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):m(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,n,r,i){let o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){let r=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let a;for(r>o/2&&(r=o/2),a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?Gf(t):Gf(t.slice(e,n))}function N(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+a<=n){let n,r,s,u;switch(a){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],s=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(t){const e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(o.isBuffer(e)||(e=o.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!o.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},o.byteLength=d,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(t+=" ... "),""},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(t,e,n,r,i){if(H(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const u=Math.min(a,s),c=this.slice(r,i),l=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return g(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return w(this,t,e,n);case"base64":return b(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function E(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function S(t,e,n,r,i,a){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function j(t,e,n,r,i){R(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,n}function C(t,e,n,r,i){R(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=a,a>>=8,t[n+2]=a,a>>=8,t[n+1]=a,a>>=8,t[n]=a,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,4),Zf(t,e,n,r,23,4),n+4}function z(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,8),Zf(t,e,n,r,52,8),n+8}o.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readBigUInt64LE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readBigInt64LE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||L(t,4,this.length),qf(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),qf(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),qf(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),qf(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||S(this,t,e,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r||S(this,t,e,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigUInt64LE=Z((function(t,e=0){return j(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Z((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,t,e,n,r-1,-r)}let i=0,o=1,a=0;for(this[e]=255&t;++i>0)-a&255;return e+n},o.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,t,e,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/o>>0)-a&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigInt64LE=Z((function(t,e=0){return j(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Z((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(t,e,n){return O(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return O(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return z(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return z(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function R(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new P.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){U(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||Q(e,t.length-(n+1))}(r,i,o)}function U(t,e){if("number"!=typeof t)throw new P.ERR_INVALID_ARG_TYPE(e,"number",t)}function Q(t,e,n){if(Math.floor(t)!==t)throw U(t,n),new P.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new P.ERR_BUFFER_OUT_OF_BOUNDS;throw new P.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}_("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),_("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),_("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=B(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=B(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const Y=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let a=0;a55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.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;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(t){return Hf(function(t){if((t=(t=t.split("=")[0]).trim().replace(Y,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function H(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function G(t){return t!=t}const q=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}})),Xf=_f((function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Jf.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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 p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}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 r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.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;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 I(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){I.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return v[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,I),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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,Pf)})); +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */let Kf=!1,$f=!1;const tp={debug:1,default:2,info:2,warning:3,error:4,off:5};let ep=tp.default,np=null;const rp=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(n){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var ip,op;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(ip||(ip={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(op||(op={}));const ap="0123456789abcdef";class sp{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();null==tp[n]&&this.throwArgumentError("invalid log level name","logLevel",t),ep>tp[n]||console.log.apply(console,e)}debug(...t){this._log(sp.levels.DEBUG,t)}info(...t){this._log(sp.levels.INFO,t)}warn(...t){this._log(sp.levels.WARNING,t)}makeError(t,e,n){if($f)return this.makeError("censored error",e,{});e||(e=sp.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((t=>{const e=n[t];try{if(e instanceof Uint8Array){let n="";for(let t=0;t>4],n+=ap[15&e[t]];r.push(t+"=Uint8Array(0x"+n+")")}else r.push(t+"="+JSON.stringify(e))}catch(e){r.push(t+"="+JSON.stringify(n[t].toString()))}})),r.push(`code=${e}`),r.push(`version=${this.version}`);const i=t;let o="";switch(e){case op.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case op.CALL_EXCEPTION:case op.INSUFFICIENT_FUNDS:case op.MISSING_NEW:case op.NONCE_EXPIRED:case op.REPLACEMENT_UNDERPRICED:case op.TRANSACTION_REPLACED:case op.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(t+=" ("+r.join(", ")+")");const a=new Error(t);return a.reason=i,a.code=e,Object.keys(n).forEach((function(t){a[t]=n[t]})),a}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,sp.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,r){t||this.throwError(e,n,r)}assertArgument(t,e,n,r){t||this.throwArgumentError(e,n,r)}checkNormalize(t){rp&&this.throwError("platform missing String.prototype.normalize",sp.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:rp})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,sp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,sp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",te&&this.throwError("too many arguments"+n,sp.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",sp.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",sp.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",sp.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return np||(np=new sp("logger/5.7.0")),np}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",sp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Kf){if(!t)return;this.globalLogger().throwError("error censorship permanent",sp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}$f=!!t,Kf=!!e}static setLogLevel(t){const e=tp[t.toLowerCase()];null!=e?ep=e:sp.globalLogger().warn("invalid log level - "+t)}static from(t){return new sp(t)}}sp.errors=op,sp.levels=ip;const up=new sp("bytes/5.7.0");function cp(t){return!!t.toHexString}function lp(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return lp(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function hp(t){return vp(t)&&!(t.length%2)||fp(t)}function dp(t){return"number"==typeof t&&t==t&&t%1==0}function fp(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!dp(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function pp(t,e){if(e||(e={}),"number"==typeof t){up.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),lp(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),cp(t)&&(t=t.toHexString()),vp(t)){let n=t.substring(2);n.length%2&&("left"===e.hexPad?n="0"+n:"right"===e.hexPad?n+="0":up.throwArgumentError("hex data is odd-length","value",t));const r=[];for(let t=0;tpp(t))),n=e.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(n);return e.reduce(((t,e)=>(r.set(e,t),t+e.length)),0),lp(r)}function mp(t){let e=pp(t);if(0===e.length)return e;let n=0;for(;ne&&up.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(e);return n.set(t,e-t.length),lp(n)}function vp(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const wp="0123456789abcdef";function bp(t,e){if(e||(e={}),"number"==typeof t){up.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=wp[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),cp(t))return t.toHexString();if(vp(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":up.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(fp(t)){let e="0x";for(let n=0;n>4]+wp[15&r]}return e}return up.throwArgumentError("invalid hexlify value","value",t)}function Mp(t){if("string"!=typeof t)t=bp(t);else if(!vp(t)||t.length%2)return null;return(t.length-2)/2}function Ap(t,e,n){return"string"!=typeof t?t=bp(t):(!vp(t)||t.length%2)&&up.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=n?"0x"+t.substring(e,2+2*n):"0x"+t.substring(e)}function Np(t){let e="0x";return t.forEach((t=>{e+=bp(t).substring(2)})),e}function Ip(t){const e=function(t){"string"!=typeof t&&(t=bp(t)),vp(t)||up.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&up.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function xp(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(hp(t)){let n=pp(t);64===n.length?(e.v=27+(n[32]>>7),n[32]&=127,e.r=bp(n.slice(0,32)),e.s=bp(n.slice(32,64))):65===n.length?(e.r=bp(n.slice(0,32)),e.s=bp(n.slice(32,64)),e.v=n[64]):up.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:up.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(n[32]|=128),e._vs=bp(n.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const n=gp(pp(e._vs),32);e._vs=bp(n);const r=n[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=r:e.recoveryParam!==r&&up.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;const i=bp(n);null==e.s?e.s=i:e.s!==i&&up.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?up.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const n=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==n&&up.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&vp(e.r)?e.r=Ep(e.r,32):up.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&vp(e.s)?e.s=Ep(e.s,32):up.throwArgumentError("signature missing or invalid s","signature",t);const n=pp(e.s);n[0]>=128&&up.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(n[0]|=128);const r=bp(n);e._vs&&(vp(e._vs)||up.throwArgumentError("signature invalid _vs","signature",t),e._vs=Ep(e._vs,32)),null==e._vs?e._vs=r:e._vs!==r&&up.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const kp="bignumber/5.7.0";var Tp=Xf.BN;const Lp=new sp(kp),Sp={},jp=9007199254740991;let Cp=!1;class Dp{constructor(t,e){t!==Sp&&Lp.throwError("cannot call constructor directly; use BigNumber.from",sp.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return zp(Pp(this).fromTwos(t))}toTwos(t){return zp(Pp(this).toTwos(t))}abs(){return"-"===this._hex[0]?Dp.from(this._hex.substring(1)):this}add(t){return zp(Pp(this).add(Pp(t)))}sub(t){return zp(Pp(this).sub(Pp(t)))}div(t){return Dp.from(t).isZero()&&_p("division-by-zero","div"),zp(Pp(this).div(Pp(t)))}mul(t){return zp(Pp(this).mul(Pp(t)))}mod(t){const e=Pp(t);return e.isNeg()&&_p("division-by-zero","mod"),zp(Pp(this).umod(e))}pow(t){const e=Pp(t);return e.isNeg()&&_p("negative-power","pow"),zp(Pp(this).pow(e))}and(t){const e=Pp(t);return(this.isNegative()||e.isNeg())&&_p("unbound-bitwise-result","and"),zp(Pp(this).and(e))}or(t){const e=Pp(t);return(this.isNegative()||e.isNeg())&&_p("unbound-bitwise-result","or"),zp(Pp(this).or(e))}xor(t){const e=Pp(t);return(this.isNegative()||e.isNeg())&&_p("unbound-bitwise-result","xor"),zp(Pp(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&_p("negative-width","mask"),zp(Pp(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&_p("negative-width","shl"),zp(Pp(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&_p("negative-width","shr"),zp(Pp(this).shrn(t))}eq(t){return Pp(this).eq(Pp(t))}lt(t){return Pp(this).lt(Pp(t))}lte(t){return Pp(this).lte(Pp(t))}gt(t){return Pp(this).gt(Pp(t))}gte(t){return Pp(this).gte(Pp(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Pp(this).isZero()}toNumber(){try{return Pp(this).toNumber()}catch(t){_p("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Lp.throwError("this platform does not support BigInt",sp.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Cp||(Cp=!0,Lp.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Lp.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",sp.errors.UNEXPECTED_ARGUMENT,{}):Lp.throwError("BigNumber.toString does not accept parameters",sp.errors.UNEXPECTED_ARGUMENT,{})),Pp(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Dp)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Dp(Sp,Op(t)):t.match(/^-?[0-9]+$/)?new Dp(Sp,Op(new Tp(t))):Lp.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&_p("underflow","BigNumber.from",t),(t>=jp||t<=-jp)&&_p("overflow","BigNumber.from",t),Dp.from(String(t));const e=t;if("bigint"==typeof e)return Dp.from(e.toString());if(fp(e))return Dp.from(bp(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Dp.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(vp(t)||"-"===t[0]&&vp(t.substring(1))))return Dp.from(t)}return Lp.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Op(t){if("string"!=typeof t)return Op(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Lp.throwArgumentError("invalid hex","value",t),"0x00"===(t=Op(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function zp(t){return Dp.from(Op(t))}function Pp(t){const e=Dp.from(t).toHexString();return"-"===e[0]?new Tp("-"+e.substring(3),16):new Tp(e.substring(2),16)}function _p(t,e,n){const r={fault:t,operation:e};return null!=n&&(r.value=n),Lp.throwError(t,sp.errors.NUMERIC_FAULT,r)}const Bp=new sp(kp),Rp={},Up=Dp.from(0),Qp=Dp.from(-1);function Yp(t,e,n,r){const i={fault:e,operation:n};return void 0!==r&&(i.value=r),Bp.throwError(t,sp.errors.NUMERIC_FAULT,i)}let Wp="0";for(;Wp.length<256;)Wp+=Wp;function Fp(t){if("number"!=typeof t)try{t=Dp.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+Wp.substring(0,t):Bp.throwArgumentError("invalid decimal size","decimals",t)}function Vp(t,e){null==e&&(e=0);const n=Fp(e),r=(t=Dp.from(t)).lt(Up);r&&(t=t.mul(Qp));let i=t.mod(n).toString();for(;i.length2&&Bp.throwArgumentError("too many decimal points","value",t);let o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>n.length-1&&Yp("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.lengthnull==t[e]?r:(typeof t[e]!==n&&Bp.throwArgumentError("invalid fixed format ("+e+" not "+n+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),n=i("width","number",n),r=i("decimals","number",r)}return n%8&&Bp.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),r>80&&Bp.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",r),new Gp(Rp,e,n,r)}}class qp{constructor(t,e,n,r){t!==Rp&&Bp.throwError("cannot use FixedNumber constructor; use FixedNumber.from",sp.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=e,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&Bp.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=Hp(this._value,this.format.decimals),n=Hp(t._value,t.format.decimals);return qp.fromValue(e.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=Hp(this._value,this.format.decimals),n=Hp(t._value,t.format.decimals);return qp.fromValue(e.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=Hp(this._value,this.format.decimals),n=Hp(t._value,t.format.decimals);return qp.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=Hp(this._value,this.format.decimals),n=Hp(t._value,t.format.decimals);return qp.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=qp.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(e=e.subUnsafe(Zp.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=qp.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(e=e.addUnsafe(Zp.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&Bp.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const n=qp.from("1"+Wp.substring(0,t),this.format),r=Jp.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(r).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){return null==t?this._hex:(t%8&&Bp.throwArgumentError("invalid byte width","width",t),Ep(Dp.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8))}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return qp.fromString(this._value,t)}static fromValue(t,e,n){return null!=n||null==e||function(t){return null!=t&&(Dp.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||vp(t)||"bigint"==typeof t||fp(t))}(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),qp.fromString(Vp(t,e),Gp.from(n))}static fromString(t,e){null==e&&(e="fixed");const n=Gp.from(e),r=Hp(t,n.decimals);!n.signed&&r.lt(Up)&&Yp("unsigned value cannot be negative","overflow","value",t);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=Ep(i,n.width/8));const o=Vp(r,n.decimals);return new qp(Rp,i,o,n)}static fromBytes(t,e){null==e&&(e="fixed");const n=Gp.from(e);if(pp(t).length>n.width/8)throw new Error("overflow");let r=Dp.from(t);n.signed&&(r=r.fromTwos(n.width));const i=r.toTwos((n.signed?0:1)+n.width).toHexString(),o=Vp(r,n.decimals);return new qp(Rp,i,o,n)}static from(t,e){if("string"==typeof t)return qp.fromString(t,e);if(fp(t))return qp.fromBytes(t,e);try{return qp.fromValue(t,0,e)}catch(t){if(t.code!==sp.errors.INVALID_ARGUMENT)throw t}return Bp.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const Zp=qp.from(1),Jp=qp.from("0.5"),Xp=new sp("properties/5.7.0");function Kp(t,e,n){Object.defineProperty(t,e,{enumerable:!0,value:n,writable:!1})}function $p(t,e){for(let n=0;n<32;n++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function ty(t){return function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const n=t[e];return Promise.resolve(n).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function ey(t){const e={};for(const n in t)e[n]=t[n];return e}const ny={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function ry(t){if(null==t||ny[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let n=0;noy(t))));if("object"==typeof t){const e={};for(const n in t){const r=t[n];void 0!==r&&Kp(e,n,oy(r))}return e}return Xp.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function oy(t){return iy(t)}class ay{constructor(t){for(const e in t)this[e]=oy(t[e])}}const sy="abi/5.7.0",uy=new sp(sy),cy={};let ly={calldata:!0,memory:!0,storage:!0},hy={calldata:!0,memory:!0};function dy(t,e){if("bytes"===t||"string"===t){if(ly[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&hy[e])return!0;return(ly[e]||"payable"===e)&&uy.throwArgumentError("invalid modifier","name",e),!1}function fy(t,e){for(let n in e)Kp(t,n,e[n])}const py=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),yy=new RegExp(/^(.*)\[([0-9]*)\]$/);class my{constructor(t,e){t!==cy&&uy.throwError("use fromString",sp.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),fy(this,e);let n=this.type.match(yy);fy(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:my.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=py.sighash),py[t]||uy.throwArgumentError("invalid format type","format",t),t===py.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==py.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===py.full?", ":",")+")"):e+=this.type,t!==py.sighash&&(!0===this.indexed&&(e+=" indexed"),t===py.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?my.fromString(t,e):my.fromObject(t)}static fromObject(t){return my.isParamType(t)?t:new my(cy,{name:t.name||null,type:ky(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(my.fromObject):null})}static fromString(t,e){return n=function(t,e){let n=t;function r(e){uy.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(t){let n={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(n.indexed=!1),n}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},a=o;for(let n=0;nmy.fromString(t,e)))}class vy{constructor(t,e){t!==cy&&uy.throwError("use a static from method",sp.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),fy(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return vy.isFragment(t)?t:"string"==typeof t?vy.fromString(t):vy.fromObject(t)}static fromObject(t){if(vy.isFragment(t))return t;switch(t.type){case"function":return Iy.fromObject(t);case"event":return wy.fromObject(t);case"constructor":return Ny.fromObject(t);case"error":return xy.fromObject(t);case"fallback":case"receive":return null}return uy.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?wy.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?Iy.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Ny.fromString(t.trim()):"error"===t.split(" ")[0]?xy.fromString(t.substring(5).trim()):uy.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class wy extends vy{format(t){if(t||(t=py.sighash),py[t]||uy.throwArgumentError("invalid format type","format",t),t===py.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==py.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===py.full?", ":",")+") ",t!==py.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?wy.fromString(t):wy.fromObject(t)}static fromObject(t){if(wy.isEventFragment(t))return t;"event"!==t.type&&uy.throwArgumentError("invalid event object","value",t);const e={name:Ly(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(my.fromObject):[],type:"event"};return new wy(cy,e)}static fromString(t){let e=t.match(Sy);e||uy.throwArgumentError("invalid event string","value",t);let n=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":n=!0;break;case"":break;default:uy.warn("unknown modifier: "+t)}})),wy.fromObject({name:e[1].trim(),anonymous:n,inputs:gy(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function by(t,e){e.gas=null;let n=t.split("@");return 1!==n.length?(n.length>2&&uy.throwArgumentError("invalid human-readable ABI signature","value",t),n[1].match(/^[0-9]+$/)||uy.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=Dp.from(n[1]),n[0]):t}function My(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function Ay(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&uy.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&uy.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||uy.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&uy.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&uy.throwArgumentError("unable to determine stateMutability","value",t),e}class Ny extends vy{format(t){if(t||(t=py.sighash),py[t]||uy.throwArgumentError("invalid format type","format",t),t===py.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===py.sighash&&uy.throwError("cannot format a constructor for sighash",sp.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===py.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Ny.fromString(t):Ny.fromObject(t)}static fromObject(t){if(Ny.isConstructorFragment(t))return t;"constructor"!==t.type&&uy.throwArgumentError("invalid constructor object","value",t);let e=Ay(t);e.constant&&uy.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(my.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?Dp.from(t.gas):null};return new Ny(cy,n)}static fromString(t){let e={type:"constructor"},n=(t=by(t,e)).match(Sy);return n&&"constructor"===n[1].trim()||uy.throwArgumentError("invalid constructor string","value",t),e.inputs=gy(n[2].trim(),!1),My(n[3].trim(),e),Ny.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class Iy extends Ny{format(t){if(t||(t=py.sighash),py[t]||uy.throwArgumentError("invalid format type","format",t),t===py.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==py.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===py.full?", ":",")+") ",t!==py.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?Iy.fromString(t):Iy.fromObject(t)}static fromObject(t){if(Iy.isFunctionFragment(t))return t;"function"!==t.type&&uy.throwArgumentError("invalid function object","value",t);let e=Ay(t);const n={type:t.type,name:Ly(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(my.fromObject):[],outputs:t.outputs?t.outputs.map(my.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?Dp.from(t.gas):null};return new Iy(cy,n)}static fromString(t){let e={type:"function"},n=(t=by(t,e)).split(" returns ");n.length>2&&uy.throwArgumentError("invalid function string","value",t);let r=n[0].match(Sy);if(r||uy.throwArgumentError("invalid function signature","value",t),e.name=r[1].trim(),e.name&&Ly(e.name),e.inputs=gy(r[2],!1),My(r[3].trim(),e),n.length>1){let r=n[1].match(Sy);""==r[1].trim()&&""==r[3].trim()||uy.throwArgumentError("unexpected tokens","value",t),e.outputs=gy(r[2],!1)}else e.outputs=[];return Iy.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function Ey(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||uy.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class xy extends vy{format(t){if(t||(t=py.sighash),py[t]||uy.throwArgumentError("invalid format type","format",t),t===py.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==py.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===py.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?xy.fromString(t):xy.fromObject(t)}static fromObject(t){if(xy.isErrorFragment(t))return t;"error"!==t.type&&uy.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:Ly(t.name),inputs:t.inputs?t.inputs.map(my.fromObject):[]};return Ey(new xy(cy,e))}static fromString(t){let e={type:"error"},n=t.match(Sy);return n||uy.throwArgumentError("invalid error signature","value",t),e.name=n[1].trim(),e.name&&Ly(e.name),e.inputs=gy(n[2],!1),Ey(xy.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function ky(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const Ty=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ly(t){return t&&t.match(Ty)||uy.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const Sy=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),jy=new sp(sy);class Cy{constructor(t,e,n,r){this.name=t,this.type=e,this.localName=n,this.dynamic=r}_throwError(t,e){jy.throwArgumentError(t,this.localName,e)}}class Dy{constructor(t){Kp(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return Np(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(yp(t._data))}writeBytes(t){let e=pp(t);const n=e.length%this.wordSize;return n&&(e=yp([e,this._padding.slice(n)])),this._writeData(e)}_getValue(t){let e=pp(Dp.from(t));return e.length>this.wordSize&&jy.throwError("value out-of-bounds",sp.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=yp([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class Oy{constructor(t,e,n,r){Kp(this,"_data",pp(t)),Kp(this,"wordSize",e||32),Kp(this,"_coerceFunc",n),Kp(this,"allowLoose",r),this._offset=0}get data(){return bp(this._data)}get consumed(){return this._offset}static coerce(t,e){let n=t.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):Oy.coerce(t,e)}_peekBytes(t,e,n){let r=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&(this.allowLoose&&n&&this._offset+e<=this._data.length?r=e:jy.throwError("data out-of-bounds",sp.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r})),this._data.slice(this._offset,this._offset+r)}subReader(t){return new Oy(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let n=this._peekBytes(0,t,!!e);return this._offset+=n.length,n.slice(0,t)}readValue(){return Dp.from(this.readBytes(this.wordSize))}}var zy=_f((function(t){!function(){var e="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof k&&k.versions&&k.versions.node?r=Pf:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&t.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),u=[4,1024,262144,67108864],c=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],d=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var y=function(t,e,n){return function(r){return new j(t,e,t).update(r)[n]()}},m=function(t,e,n){return function(r,i){return new j(t,e,i).update(r)[n]()}},g=function(t,e,n){return function(e,r,i,o){return A["cshake"+t].update(e,r,i,o)[n]()}},v=function(t,e,n){return function(e,r,i,o){return A["kmac"+t].update(e,r,i,o)[n]()}},w=function(t,e,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function C(t,e,n){j.call(this,t,e,n)}j.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}for(var i,o,s=this.blocks,u=this.byteCount,l=t.length,h=this.blockCount,d=0,f=this.s;d>2]|=t[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(s[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=u){for(this.start=i-u,this.block=s[h],i=0;i>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},j.prototype.encodeString=function(t){var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}var i=0,o=t.length;if(n)i=o;else for(var s=0;s=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},j.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e>4&15]+s[15&t]+s[t>>12&15]+s[t>>8&15]+s[t>>20&15]+s[t>>16&15]+s[t>>28&15]+s[t>>24&15];a%e==0&&(D(n),o=0)}return i&&(t=n[o],u+=s[t>>4&15]+s[15&t],i>1&&(u+=s[t>>12&15]+s[t>>8&15]),i>2&&(u+=s[t>>20&15]+s[t>>16&15])),u},j.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&D(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},C.prototype=new j,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),j.prototype.finalize.call(this)};var D=function(t){var e,n,r,i,o,a,s,u,c,h,d,f,p,y,m,g,v,w,b,M,A,N,I,E,x,k,T,L,S,j,C,D,O,z,P,_,B,R,U,Q,Y,W,F,V,H,G,q,Z,J,X,K,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(h<<1|d>>>31),n=s^(d<<1|h>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=h^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,y=t[0],m=t[1],G=t[11]<<4|t[10]>>>28,q=t[10]<<4|t[11]>>>28,L=t[20]<<3|t[21]>>>29,S=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,W=t[40]<<18|t[41]>>>14,F=t[41]<<18|t[40]>>>14,z=t[2]<<1|t[3]>>>31,P=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,Z=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,j=t[33]<<13|t[32]>>>19,C=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,_=t[14]<<6|t[15]>>>26,B=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,K=t[35]<<15|t[34]>>>17,D=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,E=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,R=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,H=t[9]<<27|t[8]>>>5,k=t[18]<<20|t[19]>>>12,T=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,Q=t[38]<<8|t[39]>>>24,Y=t[39]<<8|t[38]>>>24,N=t[48]<<14|t[49]>>>18,I=t[49]<<14|t[48]>>>18,t[0]=y^~g&w,t[1]=m^~v&b,t[10]=E^~k&L,t[11]=x^~T&S,t[20]=z^~_&R,t[21]=P^~B&U,t[30]=V^~G&Z,t[31]=H^~q&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=g^~w&M,t[3]=v^~b&A,t[12]=k^~L&j,t[13]=T^~S&C,t[22]=_^~R&Q,t[23]=B^~U&Y,t[32]=G^~Z&X,t[33]=q^~J&K,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=w^~M&N,t[5]=b^~A&I,t[14]=L^~j&D,t[15]=S^~C&O,t[24]=R^~Q&W,t[25]=U^~Y&F,t[34]=Z^~X&$,t[35]=J^~K&tt,t[44]=ot^~st&ct,t[45]=at^~ut<,t[6]=M^~N&y,t[7]=A^~I&m,t[16]=j^~D&E,t[17]=C^~O&x,t[26]=Q^~W&z,t[27]=Y^~F&P,t[36]=X^~$&V,t[37]=K^~tt&H,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=N^~y&g,t[9]=I^~m&v,t[18]=D^~E&k,t[19]=O^~x&T,t[28]=W^~z&_,t[29]=F^~P&B,t[38]=$^~V&G,t[39]=tt^~H&q,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=l[r],t[1]^=l[r+1]};if(o)t.exports=A;else for(I=0;I>=8;return e}function Ry(t,e,n){let r=0;for(let i=0;ie+1+r&&_y.throwError("child data too short",sp.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function Wy(t,e){if(0===t.length&&_y.throwError("data too short",sp.errors.BUFFER_OVERRUN,{}),t[e]>=248){const n=t[e]-247;e+1+n>t.length&&_y.throwError("data short segment too short",sp.errors.BUFFER_OVERRUN,{});const r=Ry(t,e+1,n);return e+1+n+r>t.length&&_y.throwError("data long segment too short",sp.errors.BUFFER_OVERRUN,{}),Yy(t,e,e+1+n,n+r)}if(t[e]>=192){const n=t[e]-192;return e+1+n>t.length&&_y.throwError("data array too short",sp.errors.BUFFER_OVERRUN,{}),Yy(t,e,e+1,n)}if(t[e]>=184){const n=t[e]-183;e+1+n>t.length&&_y.throwError("data array too short",sp.errors.BUFFER_OVERRUN,{});const r=Ry(t,e+1,n);return e+1+n+r>t.length&&_y.throwError("data array too short",sp.errors.BUFFER_OVERRUN,{}),{consumed:1+n+r,result:bp(t.slice(e+1+n,e+1+n+r))}}if(t[e]>=128){const n=t[e]-128;return e+1+n>t.length&&_y.throwError("data too short",sp.errors.BUFFER_OVERRUN,{}),{consumed:1+n,result:bp(t.slice(e+1,e+1+n))}}return{consumed:1,result:bp(t[e])}}function Fy(t){const e=pp(t),n=Wy(e,0);return n.consumed!==e.length&&_y.throwArgumentError("invalid rlp data","data",t),n.result}const Vy=new sp("address/5.7.0");function Hy(t){vp(t,20)||Vy.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let t=0;t<40;t++)n[t]=e[t].charCodeAt(0);const r=pp(Py(n));for(let t=0;t<40;t+=2)r[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&r[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Gy={};for(let t=0;t<10;t++)Gy[String(t)]=String(t);for(let t=0;t<26;t++)Gy[String.fromCharCode(65+t)]=String(10+t);const qy=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Zy(t){let e=null;if("string"!=typeof t&&Vy.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Hy(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Vy.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Gy[t])).join("");for(;e.length>=qy;){let t=e.substring(0,qy);e=parseInt(t,10)%97+e.substring(t.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}(t)&&Vy.throwArgumentError("bad icap checksum","address",t),n=t.substring(4),e=new Tp(n,36).toString(16);e.length<40;)e="0"+e;e=Hy("0x"+e)}else Vy.throwArgumentError("invalid address","address",t);var n;return e}function Jy(t){let e=null;try{e=Zy(t.from)}catch(e){Vy.throwArgumentError("missing from address","transaction",t)}return Zy(Ap(Py(Qy([e,mp(pp(Dp.from(t.nonce).toHexString()))])),12))}class Xy extends Cy{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=Zy(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return Zy(Ep(t.readValue().toHexString(),20))}}class Ky extends Cy{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const $y=new sp(sy);function tm(t,e,n){let r=null;if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let t={};r=e.map((e=>{const r=e.localName;return r||$y.throwError("cannot encode object for signature with missing names",sp.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[r]&&$y.throwError("cannot encode object for signature with duplicate names",sp.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[r]=!0,n[r]}))}else $y.throwArgumentError("invalid tuple value","tuple",n);e.length!==r.length&&$y.throwArgumentError("types/value length mismatch","tuple",n);let i=new Dy(t.wordSize),o=new Dy(t.wordSize),a=[];e.forEach(((t,e)=>{let n=r[e];if(t.dynamic){let e=o.length;t.encode(o,n);let r=i.writeUpdatableValue();a.push((t=>{r(t+e)}))}else t.encode(i,n)})),a.forEach((t=>{t(i.length)}));let s=t.appendWriter(i);return s+=t.appendWriter(o),s}function em(t,e){let n=[],r=t.subReader(0);e.forEach((e=>{let i=null;if(e.dynamic){let n=t.readValue(),o=r.subReader(n.toNumber());try{i=e.decode(o)}catch(t){if(t.code===sp.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===sp.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&n.push(i)}));const i=e.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});e.forEach(((t,e)=>{let r=t.localName;if(!r||1!==i[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const o=n[e];o instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw o}}):n[r]=o}));for(let t=0;t{throw e}})}return Object.freeze(n)}class nm extends Cy{constructor(t,e,n){super("array",t.type+"["+(e>=0?e:"")+"]",n,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let n=0;nt._data.length&&$y.throwError("insufficient data length",sp.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let n=[];for(let t=0;t>6==2;r++)t++;return t}return t===ym.OVERRUN?n.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(pm||(pm={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(ym||(ym={}));const gm=Object.freeze({error:function(t,e,n,r,i){return fm.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",n)},ignore:mm,replace:function(t,e,n,r,i){return t===ym.OVERLONG?(r.push(i),0):(r.push(65533),mm(t,e,n))}});function vm(t,e){null==e&&(e=gm.error),t=pp(t);const n=[];let r=0;for(;r>7==0){n.push(i);continue}let o=null,a=null;if(192==(224&i))o=1,a=127;else if(224==(240&i))o=2,a=2047;else{if(240!=(248&i)){r+=e(128==(192&i)?ym.UNEXPECTED_CONTINUE:ym.BAD_PREFIX,r-1,t,n);continue}o=3,a=65535}if(r-1+o>=t.length){r+=e(ym.OVERRUN,r-1,t,n);continue}let s=i&(1<<8-o-1)-1;for(let i=0;i1114111?r+=e(ym.OUT_OF_RANGE,r-1-o,t,n,s):s>=55296&&s<=57343?r+=e(ym.UTF16_SURROGATE,r-1-o,t,n,s):s<=a?r+=e(ym.OVERLONG,r-1-o,t,n,s):n.push(s))}return n}function wm(t,e=pm.current){e!=pm.current&&(fm.checkNormalize(),t=t.normalize(e));let n=[];for(let e=0;e>6|192),n.push(63&r|128);else if(55296==(64512&r)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&r)<<10)+(1023&i);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return pp(n)}function bm(t,e){return vm(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}class Mm extends im{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,wm(e))}decode(t){return bm(super.decode(t))}}class Am extends Cy{constructor(t,e){let n=!1;const r=[];t.forEach((t=>{t.dynamic&&(n=!0),r.push(t.type)})),super("tuple","tuple("+r.join(",")+")",e,n),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});return this.coders.forEach(((n,r)=>{let i=n.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[r]))})),Object.freeze(t)}encode(t,e){return tm(t,this.coders,e)}decode(t){return t.coerce(this.name,em(t,this.coders))}}const Nm=new sp(sy),Im=new RegExp(/^bytes([0-9]*)$/),Em=new RegExp(/^(u?int)([0-9]*)$/),xm=new class{constructor(t){Kp(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new Xy(t.name);case"bool":return new rm(t.name);case"string":return new Mm(t.name);case"bytes":return new om(t.name);case"array":return new nm(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new Am((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new sm(t.name)}let e=t.type.match(Em);if(e){let n=parseInt(e[2]||"256");return(0===n||n>256||n%8!=0)&&Nm.throwArgumentError("invalid "+e[1]+" bit length","param",t),new dm(n/8,"int"===e[1],t.name)}if(e=t.type.match(Im),e){let n=parseInt(e[1]);return(0===n||n>32)&&Nm.throwArgumentError("invalid bytes length","param",t),new am(n,t.name)}return Nm.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new Oy(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new Dy(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(my.from(t))));return new Am(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&Nm.throwError("types/values length mismatch",sp.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const n=t.map((t=>this._getCoder(my.from(t)))),r=new Am(n,"_"),i=this._getWriter();return r.encode(i,e),i.data}decode(t,e,n){const r=t.map((t=>this._getCoder(my.from(t))));return new Am(r,"_").decode(this._getReader(pp(e),n))}};function km(t){return Py(wm(t))}const Tm="hash/5.7.0";function Lm(t){t=atob(t);const e=[];for(let n=0;n0&&Array.isArray(t)?i(t,e-1):n.push(t)}))};return i(t,e),n}function Cm(t){return 1&t?~t>>1:t>>1}function Dm(t,e){let n=Array(t);for(let r=0,i=-1;re[t])):n}function Pm(t,e,n){let r=Array(t).fill(void 0).map((()=>[]));for(let i=0;ir[e].push(t)));return r}function _m(t,e){let n=1+e(),r=e(),i=function(t){let e=[];for(;;){let n=t();if(0==n)break;e.push(n)}return e}(e);return jm(Pm(i.length,1+t,e).map(((t,e)=>{const o=t[0],a=t.slice(1);return Array(i[e]).fill(void 0).map(((t,e)=>{let i=e*r;return[o+e*n,a.map((t=>t+i))]}))})))}function Bm(t,e){return Pm(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}const Rm=function(t){return function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),i=1,o=[0,1];for(let t=1;t>--u&1}const h=Math.pow(2,31),d=h>>>1,f=d>>1,p=h-1;let y=0;for(let t=0;t<31;t++)y=y<<1|l();let m=[],g=0,v=h;for(;;){let t=Math.floor(((y-g+1)*i-1)/v),e=0,n=r;for(;n-e>1;){let r=e+n>>>1;t>>1|l(),a=a<<1^d,s=(s^d)<<1|d|1;g=a,v=1+s-a}let w=r-4;return m.map((e=>{switch(e-w){case 3:return w+65792+(t[s++]<<16|t[s++]<<8|t[s++]);case 2:return w+256+(t[s++]<<8|t[s++]);case 1:return w+t[s++];default:return e-1}}))}(t))}(Lm("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),Um=new Set(zm(Rm)),Qm=new Set(zm(Rm)),Ym=function(t){let e=[];for(;;){let n=t();if(0==n)break;e.push(_m(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(Bm(n,t))}return function(t){const e={};for(let n=0;nt-e));return function n(){let r=[];for(;;){let i=zm(t,e);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort(((t,e)=>e.set.size-t.set.size));let i=t(),o=i%3;i=i/3|0;let a=!!(1&i);return i>>=1,{branches:r,valid:o,fe0f:a,save:1==i,check:2==i}}()}(Rm);function Fm(t){return function(t,e=pm.current){return vm(wm(t,e))}(t)}function Vm(t){return t.filter((t=>65039!=t))}function Hm(t){for(let e of t.split(".")){let n=Fm(e);try{for(let t=n.lastIndexOf(95)-1;t>=0;t--)if(95!==n[t])throw new Error("underscore only allowed at start");if(n.length>=4&&n.every((t=>t<128))&&45===n[2]&&45===n[3])throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${e}": ${t.message}`)}}return t}function Gm(t,e){var n;let r,i,o=Wm,a=[],s=t.length;for(e&&(e.length=0);s;){let u=t[--s];if(o=null===(n=o.branches.find((t=>t.set.has(u))))||void 0===n?void 0:n.node,!o)break;if(o.save)i=u;else if(o.check&&u===i)break;a.push(u),o.fe0f&&(a.push(65039),s>0&&65039==t[s-1]&&s--),o.valid&&(r=a.slice(),2==o.valid&&r.splice(1,1),e&&e.push(...t.slice(s).reverse()),t.length=s)}return r}const qm=new sp(Tm),Zm=new Uint8Array(32);function Jm(t){if(0===t.length)throw new Error("invalid ENS name; empty component");return t}function Xm(t){const e=wm(function(t){return Hm(function(t,e){let n=Fm(t).reverse(),r=[];for(;n.length;){let t=Gm(n);if(t){r.push(...e(t));continue}let i=n.pop();if(Um.has(i)){r.push(i);continue}if(Qm.has(i))continue;let o=Ym[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);r.push(...o)}return Hm(function(t){return t.normalize("NFC")}(String.fromCodePoint(...r)))}(t,Vm))}(t)),n=[];if(0===t.length)return n;let r=0;for(let t=0;t=e.length)throw new Error("invalid ENS name; empty component");return n.push(Jm(e.slice(r))),n}function Km(t){"string"!=typeof t&&qm.throwArgumentError("invalid ENS name; not a string","name",t);let e=Zm;const n=Xm(t);for(;n.length;)e=Py(yp([e,Py(n.pop())]));return bp(e)}Zm.fill(0);const $m=new sp(Tm),tg=new Uint8Array(32);tg.fill(0);const eg=Dp.from(-1),ng=Dp.from(0),rg=Dp.from(1),ig=Dp.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),og=Ep(rg.toHexString(),32),ag=Ep(ng.toHexString(),32),sg={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},ug=["name","version","chainId","verifyingContract","salt"];function cg(t){return function(e){return"string"!=typeof e&&$m.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const lg={name:cg("name"),version:cg("version"),chainId:function(t){try{return Dp.from(t).toString()}catch(t){}return $m.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return Zy(t).toLowerCase()}catch(t){}return $m.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=pp(t);if(32!==e.length)throw new Error("bad length");return bp(e)}catch(t){}return $m.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function hg(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const n=""===e[1],r=parseInt(e[2]||"256");(r%8!=0||r>256||e[2]&&e[2]!==String(r))&&$m.throwArgumentError("invalid numeric width","type",t);const i=ig.mask(n?r-1:r),o=n?i.add(rg).mul(eg):ng;return function(e){const n=Dp.from(e);return(n.lt(o)||n.gt(i))&&$m.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),Ep(n.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return(0===n||n>32||e[1]!==String(n))&&$m.throwArgumentError("invalid bytes width","type",t),function(e){return pp(e).length!==n&&$m.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=pp(t),n=e.length%32;return n?Np([e,tg.slice(n)]):bp(e)}(e)}}}switch(t){case"address":return function(t){return Ep(Zy(t),32)};case"bool":return function(t){return t?og:ag};case"bytes":return function(t){return Py(t)};case"string":return function(t){return km(t)}}return null}function dg(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class fg{constructor(t){Kp(this,"types",Object.freeze(oy(t))),Kp(this,"_encoderCache",{}),Kp(this,"_types",{});const e={},n={},r={};Object.keys(t).forEach((t=>{e[t]={},n[t]=[],r[t]={}}));for(const r in t){const i={};t[r].forEach((o=>{i[o.name]&&$m.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(r)}`,"types",t),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===r&&$m.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t),hg(a)||(n[a]||$m.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",t),n[a].push(r),e[r][a]=!0)}))}const i=Object.keys(n).filter((t=>0===n[t].length));0===i.length?$m.throwArgumentError("missing primary type","types",t):i.length>1&&$m.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),Kp(this,"primaryType",i[0]),function i(o,a){a[o]&&$m.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),a[o]=!0,Object.keys(e[o]).forEach((t=>{n[t]&&(i(t,a),Object.keys(a).forEach((e=>{r[e][t]=!0})))})),delete a[o]}(this.primaryType,{});for(const e in r){const n=Object.keys(r[e]);n.sort(),this._types[e]=dg(e,t[e])+n.map((e=>dg(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=hg(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],n=this.getEncoder(t),r=parseInt(e[3]);return e=>{r>=0&&e.length!==r&&$m.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(n);return this._types[t]&&(i=i.map(Py)),Py(Np(i))}}const n=this.types[t];if(n){const e=km(this._types[t]);return t=>{const r=n.map((({name:e,type:n})=>{const r=this.getEncoder(n)(t[e]);return this._types[n]?Py(r):r}));return r.unshift(e),Np(r)}}return $m.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||$m.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return Py(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,n){if(hg(t))return n(t,e);const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const t=r[1],i=parseInt(r[3]);return i>=0&&e.length!==i&&$m.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,n)))}const i=this.types[t];return i?i.reduce(((t,{name:r,type:i})=>(t[r]=this._visit(i,e[r],n),t)),{}):$m.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new fg(t)}static getPrimaryType(t){return fg.from(t).primaryType}static hashStruct(t,e,n){return fg.from(e).hashStruct(t,n)}static hashDomain(t){const e=[];for(const n in t){const r=sg[n];r||$m.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),e.push({name:n,type:r})}return e.sort(((t,e)=>ug.indexOf(t.name)-ug.indexOf(e.name))),fg.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,n){return Np(["0x1901",fg.hashDomain(t),fg.from(e).hash(n)])}static hash(t,e,n){return Py(fg.encode(t,e,n))}static resolveNames(t,e,n,r){return function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}(this,void 0,void 0,(function*(){t=ey(t);const i={};t.verifyingContract&&!vp(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=fg.from(e);o.visit(n,((t,e)=>("address"!==t||vp(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield r(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),n=o.visit(n,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:n}}))}static getPayload(t,e,n){fg.hashDomain(t);const r={},i=[];ug.forEach((e=>{const n=t[e];null!=n&&(r[e]=lg[e](n),i.push({name:e,type:sg[e]}))}));const o=fg.from(e),a=ey(e);return a.EIP712Domain?$m.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):a.EIP712Domain=i,o.encode(n),{types:a,domain:r,primaryType:o.primaryType,message:o.visit(n,((t,e)=>{if(t.match(/^bytes(\d*)/))return bp(pp(e));if(t.match(/^u?int/))return Dp.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&$m.throwArgumentError("invalid string","value",e),e}return $m.throwArgumentError("unsupported type","type",t)}))}}}const pg=new sp(sy);class yg extends ay{}class mg extends ay{}class gg extends ay{}class vg extends ay{static isIndexed(t){return!(!t||!t._isIndexed)}}const wg={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function bg(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return n.error=e,n}class Mg{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,Kp(this,"fragments",e.map((t=>vy.from(t))).filter((t=>null!=t))),Kp(this,"_abiCoder",$p(new.target,"getAbiCoder")()),Kp(this,"functions",{}),Kp(this,"errors",{}),Kp(this,"events",{}),Kp(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void pg.warn("duplicate definition - constructor"):void Kp(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let n=t.format();e[n]?pg.warn("duplicate definition - "+n):e[n]=t})),this.deploy||Kp(this,"deploy",Ny.from({payable:!1,type:"constructor"})),Kp(this,"_isInterface",!0)}format(t){t||(t=py.full),t===py.sighash&&pg.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===py.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return xm}static getAddress(t){return Zy(t)}static getSighash(t){return Ap(km(t.format()),0,4)}static getEventTopic(t){return km(t.format())}getFunction(t){if(vp(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];pg.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===n.length?pg.throwArgumentError("no matching function","name",e):n.length>1&&pg.throwArgumentError("multiple matching functions","name",e),this.functions[n[0]]}const e=this.functions[Iy.fromString(t).format()];return e||pg.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(vp(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];pg.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===n.length?pg.throwArgumentError("no matching event","name",e):n.length>1&&pg.throwArgumentError("multiple matching events","name",e),this.events[n[0]]}const e=this.events[wy.fromString(t).format()];return e||pg.throwArgumentError("no matching event","signature",t),e}getError(t){if(vp(t)){const e=$p(this.constructor,"getSighash");for(const n in this.errors)if(t===e(this.errors[n]))return this.errors[n];pg.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===n.length?pg.throwArgumentError("no matching error","name",e):n.length>1&&pg.throwArgumentError("multiple matching errors","name",e),this.errors[n[0]]}const e=this.errors[Iy.fromString(t).format()];return e||pg.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return $p(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),$p(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const n=pp(e);return bp(n.slice(0,4))!==this.getSighash(t)&&pg.throwArgumentError(`data signature does not match error ${t.name}.`,"data",bp(n)),this._decodeParams(t.inputs,n.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),bp(yp([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const n=pp(e);return bp(n.slice(0,4))!==this.getSighash(t)&&pg.throwArgumentError(`data signature does not match function ${t.name}.`,"data",bp(n)),this._decodeParams(t.inputs,n.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),bp(yp([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let n=pp(e),r=null,i="",o=null,a=null,s=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,n)}catch(t){}break;case 4:{const e=bp(n.slice(0,4)),u=wg[e];if(u)o=this._abiCoder.decode(u.inputs,n.slice(4)),a=u.name,s=u.signature,u.reason&&(r=o[0]),"Error"===a?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===a&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const t=this.getError(e);o=this._abiCoder.decode(t.inputs,n.slice(4)),a=t.name,s=t.format()}catch(t){}break}}return pg.throwError("call revert exception"+i,sp.errors.CALL_EXCEPTION,{method:t.format(),data:bp(e),errorArgs:o,errorName:a,errorSignature:s,reason:r})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),bp(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&pg.throwError("too many arguments for "+t.format(),sp.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let n=[];t.anonymous||n.push(this.getEventTopic(t));const r=(t,e)=>"string"===t.type?km(e):"bytes"===t.type?Py(bp(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=Dp.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),Ep(bp(e),32));for(e.forEach(((e,i)=>{let o=t.inputs[i];o.indexed?null==e?n.push(null):"array"===o.baseType||"tuple"===o.baseType?pg.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?n.push(e.map((t=>r(o,t)))):n.push(r(o,e)):null!=e&&pg.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const n=[],r=[],i=[];return t.anonymous||n.push(this.getEventTopic(t)),e.length!==t.inputs.length&&pg.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const a=e[o];if(t.indexed)if("string"===t.type)n.push(km(a));else if("bytes"===t.type)n.push(Py(a));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");n.push(this._abiCoder.encode([t.type],[a]))}else r.push(t),i.push(a)})),{data:this._abiCoder.encode(r,i),topics:n}}decodeEventLog(t,e,n){if("string"==typeof t&&(t=this.getEvent(t)),null!=n&&!t.anonymous){let e=this.getEventTopic(t);vp(n[0],32)&&n[0].toLowerCase()===e||pg.throwError("fragment/topic mismatch",sp.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:n[0]}),n=n.slice(1)}let r=[],i=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(r.push(my.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(r.push(t),o.push(!1)):(i.push(t),o.push(!1))}));let a=null!=n?this._abiCoder.decode(r,yp(n)):null,s=this._abiCoder.decode(i,e,!0),u=[],c=0,l=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==a)u[e]=new vg({_isIndexed:!0,hash:null});else if(o[e])u[e]=new vg({_isIndexed:!0,hash:a[l++]});else try{u[e]=a[l++]}catch(t){u[e]=t}else try{u[e]=s[c++]}catch(t){u[e]=t}if(t.name&&null==u[t.name]){const n=u[e];n instanceof Error?Object.defineProperty(u,t.name,{enumerable:!0,get:()=>{throw bg(`property ${JSON.stringify(t.name)}`,n)}}):u[t.name]=n}}));for(let t=0;t{throw bg(`index ${t}`,e)}})}return Object.freeze(u)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new mg({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:Dp.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new yg({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=bp(t);let n=this.getError(e.substring(0,10).toLowerCase());return n?new gg({args:this._abiCoder.decode(n.inputs,"0x"+e.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(t){return!(!t||!t._isInterface)}}const Ag=new sp("abstract-provider/5.7.0");class Ng extends ay{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class Ig{constructor(){Ag.checkAbstract(new.target,Ig),Kp(this,"_isProvider",!0)}getFeeData(){return function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}(this,void 0,void 0,(function*(){const{block:t,gasPrice:e}=yield ty({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((t=>null))});let n=null,r=null,i=null;return t&&t.baseFeePerGas&&(n=t.baseFeePerGas,i=Dp.from("1500000000"),r=t.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:n,maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:e}}))}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}var Eg=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const xg=new sp("abstract-signer/5.7.0"),kg=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],Tg=[sp.errors.INSUFFICIENT_FUNDS,sp.errors.NONCE_EXPIRED,sp.errors.REPLACEMENT_UNDERPRICED];class Lg{constructor(){xg.checkAbstract(new.target,Lg),Kp(this,"_isSigner",!0)}getBalance(t){return Eg(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return Eg(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return Eg(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield ty(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return Eg(this,void 0,void 0,(function*(){this._checkProvider("call");const n=yield ty(this.checkTransaction(t));return yield this.provider.call(n,e)}))}sendTransaction(t){return Eg(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),n=yield this.signTransaction(e);return yield this.provider.sendTransaction(n)}))}getChainId(){return Eg(this,void 0,void 0,(function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return Eg(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return Eg(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return Eg(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===kg.indexOf(e)&&xg.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=ey(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&xg.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return Eg(this,void 0,void 0,(function*(){const e=yield ty(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>Eg(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&xg.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const n=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!n?0!==e.type&&1!==e.type||!n||xg.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):xg.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(n&&xg.throwError("network does not support EIP-1559",sp.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):xg.throwError("failed to get consistent fee data",sp.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(Tg.indexOf(t.code)>=0)throw t;return xg.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",sp.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&xg.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield ty(e)}))}_checkProvider(t){this.provider||xg.throwError("missing provider",sp.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class Sg extends Lg{constructor(t,e){super(),Kp(this,"address",t),Kp(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{xg.throwError(t,sp.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new Sg(this.address,t)}}var jg=_f((function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Jf.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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 p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}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 r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.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;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 I(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){I.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return v[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,I),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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,Pf)})),Cg=Dg;function Dg(t,e){if(!t)throw new Error(e||"Assertion failed")}Dg.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var Og=[],zg=[],Pg="undefined"!=typeof Uint8Array?Uint8Array:Array,_g=!1;function Bg(){_g=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,n=t.length;e>18&63]+Og[i>>12&63]+Og[i>>6&63]+Og[63&i]);return o.join("")}function Ug(t){var e;_g||Bg();for(var n=t.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;su?u:s+a));return 1===r?(e=t[n-1],i+=Og[e>>2],i+=Og[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=Og[e>>10],i+=Og[e>>4&63],i+=Og[e<<2&63],i+="="),o.push(i),o.join("")}function Qg(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)}function Yg(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;t[n+f]=255&a,f+=p,a/=256,c-=8);t[n+f-p]|=128*y}var Wg={}.toString,Fg=Array.isArray||function(t){return"[object Array]"==Wg.call(t)};function Vg(){return Gg.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Hg(t,e){if(Vg()=Vg())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Vg().toString(16)+" bytes");return 0|t}function $g(t){return!(null==t||!t._isBuffer)}function tv(t,e){if($g(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return kv(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Tv(t).length;default:if(r)return kv(t).length;e=(""+e).toLowerCase(),r=!0}}function ev(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return mv(this,e,n);case"utf8":case"utf-8":return dv(this,e,n);case"ascii":return pv(this,e,n);case"latin1":case"binary":return yv(this,e,n);case"base64":return hv(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gv(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function nv(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function rv(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=Gg.from(e,r)),$g(e))return 0===e.length?-1:iv(t,e,n,r,i);if("number"==typeof e)return e&=255,Gg.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):iv(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function iv(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function hv(t,e,n){return 0===e&&n===t.length?Ug(t):Ug(t.slice(e,n))}function dv(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(t){var e=t.length;if(e<=fv)return String.fromCharCode.apply(String,t);for(var n="",r=0;r0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},Gg.prototype.compare=function(t,e,n,r,i){if(!$g(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(r,i),c=t.slice(e,n),l=0;li)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return ov(this,t,e,n);case"utf8":case"utf-8":return av(this,t,e,n);case"ascii":return sv(this,t,e,n);case"latin1":case"binary":return uv(this,t,e,n);case"base64":return cv(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lv(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},Gg.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var fv=4096;function pv(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;ir)&&(n=r);for(var i="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function wv(t,e,n,r,i,o){if(!$g(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function bv(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i>>8*(r?i:1-i)}function Mv(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i>>8*(r?i:3-i)&255}function Av(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Nv(t,e,n,r,i){return i||Av(t,0,n,4),Yg(t,e,n,r,23,4),n+4}function Iv(t,e,n,r,i){return i||Av(t,0,n,8),Yg(t,e,n,r,52,8),n+8}Gg.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),e0&&(i*=256);)r+=this[t+--e]*i;return r},Gg.prototype.readUInt8=function(t,e){return e||vv(t,1,this.length),this[t]},Gg.prototype.readUInt16LE=function(t,e){return e||vv(t,2,this.length),this[t]|this[t+1]<<8},Gg.prototype.readUInt16BE=function(t,e){return e||vv(t,2,this.length),this[t]<<8|this[t+1]},Gg.prototype.readUInt32LE=function(t,e){return e||vv(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Gg.prototype.readUInt32BE=function(t,e){return e||vv(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Gg.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||vv(t,e,this.length);for(var r=this[t],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*e)),r},Gg.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||vv(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},Gg.prototype.readInt8=function(t,e){return e||vv(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Gg.prototype.readInt16LE=function(t,e){e||vv(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},Gg.prototype.readInt16BE=function(t,e){e||vv(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},Gg.prototype.readInt32LE=function(t,e){return e||vv(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Gg.prototype.readInt32BE=function(t,e){return e||vv(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Gg.prototype.readFloatLE=function(t,e){return e||vv(t,4,this.length),Qg(this,t,!0,23,4)},Gg.prototype.readFloatBE=function(t,e){return e||vv(t,4,this.length),Qg(this,t,!1,23,4)},Gg.prototype.readDoubleLE=function(t,e){return e||vv(t,8,this.length),Qg(this,t,!0,52,8)},Gg.prototype.readDoubleBE=function(t,e){return e||vv(t,8,this.length),Qg(this,t,!1,52,8)},Gg.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||wv(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+n},Gg.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,1,255,0),Gg.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Gg.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,2,65535,0),Gg.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):bv(this,t,e,!0),e+2},Gg.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,2,65535,0),Gg.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):bv(this,t,e,!1),e+2},Gg.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,4,4294967295,0),Gg.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):Mv(this,t,e,!0),e+4},Gg.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,4,4294967295,0),Gg.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Mv(this,t,e,!1),e+4},Gg.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);wv(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+n},Gg.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);wv(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},Gg.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,1,127,-128),Gg.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Gg.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,2,32767,-32768),Gg.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):bv(this,t,e,!0),e+2},Gg.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,2,32767,-32768),Gg.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):bv(this,t,e,!1),e+2},Gg.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,4,2147483647,-2147483648),Gg.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Mv(this,t,e,!0),e+4},Gg.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||wv(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Gg.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Mv(this,t,e,!1),e+4},Gg.prototype.writeFloatLE=function(t,e,n){return Nv(this,t,e,!0,n)},Gg.prototype.writeFloatBE=function(t,e,n){return Nv(this,t,e,!1,n)},Gg.prototype.writeDoubleLE=function(t,e,n){return Iv(this,t,e,!0,n)},Gg.prototype.writeDoubleBE=function(t,e,n){return Iv(this,t,e,!1,n)},Gg.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=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=0;--i)t[i+e]=this[i+n];else if(o<1e3||!Gg.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.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;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Tv(t){return function(t){var e,n,r,i,o,a;_g||Bg();var s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new Pg(3*s/4-o),r=o>0?s-4:s;var u=0;for(e=0,n=0;e>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=zg[t.charCodeAt(e)]<<2|zg[t.charCodeAt(e+1)]>>4,a[u++]=255&i):1===o&&(i=zg[t.charCodeAt(e)]<<10|zg[t.charCodeAt(e+1)]<<4|zg[t.charCodeAt(e+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Ev,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Lv(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Sv(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var jv=function(t){return t instanceof Gg},Cv=_f((function(t,e){var n=/%[sdj%]/g;e.format=function(t){if(!y(t)){for(var e=[],r=0;r=a)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(n)?r.showHidden=n:n&&e._extend(r,n),m(r.showHidden)&&(r.showHidden=!1),m(r.depth)&&(r.depth=2),m(r.colors)&&(r.colors=!1),m(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),u(r,t,r.depth)}function a(t,e){var n=o.styles[e];return n?"["+o.colors[n][0]+"m"+t+"["+o.colors[n][1]+"m":t}function s(t,e){return t}function u(t,n,r){if(t.customInspect&&n&&M(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,t);return y(i)||(i=u(t,i,r)),i}var o=function(t,e){if(m(e))return t.stylize("undefined","undefined");if(y(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return p(e)?t.stylize(""+e,"number"):d(e)?t.stylize(""+e,"boolean"):f(e)?t.stylize("null","null"):void 0}(t,n);if(o)return o;var a=Object.keys(n),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(n)),0===a.length){if(M(n)){var v=n.name?": "+n.name:"";return t.stylize("[Function"+v+"]","special")}if(g(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(w(n))return t.stylize(Date.prototype.toString.call(n),"date");if(b(n))return c(n)}var A,N="",I=!1,E=["{","}"];return h(n)&&(I=!0,E=["[","]"]),M(n)&&(N=" [Function"+(n.name?": "+n.name:"")+"]"),g(n)&&(N=" "+RegExp.prototype.toString.call(n)),w(n)&&(N=" "+Date.prototype.toUTCString.call(n)),b(n)&&(N=" "+c(n)),0!==a.length||I&&0!=n.length?r<0?g(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special"):(t.seen.push(n),A=I?function(t,e,n,r,i){for(var o=[],a=0,s=e.length;a60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}(A,N,E)):E[0]+N+E[1]}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function l(t,e,n,r,i,o){var a,s,c;if((c=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(s=t.stylize("[Setter]","special")),x(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(c.value)<0?(s=f(n)?u(t,c.value,null):u(t,c.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),m(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function h(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function f(t){return null===t}function p(t){return"number"==typeof t}function y(t){return"string"==typeof t}function m(t){return void 0===t}function g(t){return v(t)&&"[object RegExp]"===A(t)}function v(t){return"object"==typeof t&&null!==t}function w(t){return v(t)&&"[object Date]"===A(t)}function b(t){return v(t)&&("[object Error]"===A(t)||t instanceof Error)}function M(t){return"function"==typeof t}function A(t){return Object.prototype.toString.call(t)}function N(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(m(r)&&(r=k.env.NODE_DEBUG||""),t=t.toUpperCase(),!i[t])if(new RegExp("\\b"+t+"\\b","i").test(r)){var n=k.pid;i[t]=function(){var r=e.format.apply(e,arguments);console.error("%s %d: %s",t,n,r)}}else i[t]=function(){};return i[t]},e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=h,e.isBoolean=d,e.isNull=f,e.isNullOrUndefined=function(t){return null==t},e.isNumber=p,e.isString=y,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=m,e.isRegExp=g,e.isObject=v,e.isDate=w,e.isError=b,e.isFunction=M,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=jv;var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function E(){var t=new Date,e=[N(t.getHours()),N(t.getMinutes()),N(t.getSeconds())].join(":");return[t.getDate(),I[t.getMonth()],e].join(" ")}function x(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",E(),e.format.apply(e,arguments))},e.inherits=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})},e._extend=function(t,e){if(!e||!v(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}})),Dv=_f((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}}));function Ov(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function zv(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function Pv(t){return 1===t.length?"0"+t:t}function _v(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}var Bv={inherits:_f((function(t){try{var e=Cv;if("function"!=typeof e.inherits)throw"";t.exports=e.inherits}catch(e){t.exports=Dv}})),toArray:function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,n[r++]=63&o|128):Ov(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i>>0}return o},split32:function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},rotr32:function(t,e){return t>>>e|t<<32-e},rotl32:function(t,e){return t<>>32-e},sum32:function(t,e){return t+e>>>0},sum32_3:function(t,e,n){return t+e+n>>>0},sum32_4:function(t,e,n,r){return t+e+n+r>>>0},sum32_5:function(t,e,n,r,i){return t+e+n+r+i>>>0},sum64:function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o>>0,t[e+1]=o},sum64_hi:function(t,e,n,r){return(e+r>>>0>>0},sum64_lo:function(t,e,n,r){return e+r>>>0},sum64_4_hi:function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)>>0)>>0)>>0},sum64_4_lo:function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},sum64_5_hi:function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)>>0)>>0)>>0)>>0},sum64_5_lo:function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},rotr64_hi:function(t,e,n){return(e<<32-n|t>>>n)>>>0},rotr64_lo:function(t,e,n){return(t<<32-n|e>>>n)>>>0},shr64_hi:function(t,e,n){return t>>>n},shr64_lo:function(t,e,n){return(t<<32-n|e>>>n)>>>0}};function Rv(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var Uv=Rv;Rv.prototype.update=function(t,e){if(t=Bv.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=Bv.join32(t,0,t.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},Kv=function(t){return Yv(t,17)^Yv(t,19)^t>>>10},$v=Bv.rotl32,tw=Bv.sum32,ew=Bv.sum32_5,nw=Hv,rw=Qv.BlockHash,iw=[1518500249,1859775393,2400959708,3395469782];function ow(){if(!(this instanceof ow))return new ow;rw.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Bv.inherits(ow,rw);var aw=ow;ow.blockSize=512,ow.outSize=160,ow.hmacStrength=80,ow.padLength=64,ow.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;rthis.blockSize&&(t=(new this.Hash).update(t).digest()),Cg(t.length<=this.blockSize);for(var e=t.length;e>8,a=255&i;o?n.push(o,a):n.push(a)}return n},n.zero2=r,n.toHex=i,n.encode=function(t,e){return"hex"===e?i(t):t}})),bb=mb((function(t,e){var n=e;n.assert=gb,n.toArray=wb.toArray,n.zero2=wb.zero2,n.toHex=wb.toHex,n.encode=wb.encode,n.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},n.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!=(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0==(1&c)?0:3!=(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},n.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new jg(t,"hex","le")}})),Mb=bb.getNAF,Ab=bb.getJSF,Nb=bb.assert;function Ib(t,e){this.type=t,this.p=new jg(e.p,16),this.red=e.prime?jg.red(e.prime):jg.mont(this.p),this.zero=new jg(0).toRed(this.red),this.one=new jg(1).toRed(this.red),this.two=new jg(2).toRed(this.red),this.n=e.n&&new jg(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Eb=Ib;function xb(t,e){this.curve=t,this.type=e,this.precomputed=null}Ib.prototype.point=function(){throw new Error("Not implemented")},Ib.prototype.validate=function(){throw new Error("Not implemented")},Ib.prototype._fixedNafMul=function(t,e){Nb(t.precomputed);var n=t._getDoubles(),r=Mb(e,1,this._bitLength),i=(1<=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];Nb(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},Ib.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var y=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(y[1]=e[f].add(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].add(e[p].neg())):(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=Ab(n[f],n[p]);for(h=Math.max(g[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a=0;o--){for(var A=0;o>=0;){var N=!0;for(a=0;a=0&&A++,b=b.dblp(A),o<0)break;for(a=0;a0?s=c[a][I-1>>1]:I<0&&(s=c[a][-I-1>>1].neg()),b="affine"===s.type?b.mixedAdd(s):b.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},xb.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},Lb.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},Lb.prototype.pointFromX=function(t,e){(t=new jg(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},Lb.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Lb.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},jb.prototype.isInfinity=function(){return this.inf},jb.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},jb.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},jb.prototype.getX=function(){return this.x.fromRed()},jb.prototype.getY=function(){return this.y.fromRed()},jb.prototype.mul=function(t){return t=new jg(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},jb.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},jb.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},jb.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},jb.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},jb.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},kb(Cb,Eb.BasePoint),Lb.prototype.jpoint=function(t,e,n){return new Cb(this,t,e,n)},Cb.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},Cb.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Cb.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},Cb.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},Cb.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},Cb.prototype.inspect=function(){return this.isInfinity()?"":""},Cb.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Db=mb((function(t,e){var n=e;n.base=Eb,n.short=Sb,n.mont=null,n.edwards=null})),Ob=mb((function(t,e){var n,r=e,i=bb.assert;function o(t){"short"===t.type?this.curve=new Db.short(t):"edwards"===t.type?this.curve=new Db.edwards(t):this.curve=new Db.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new o(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:yb.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:yb.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:yb.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:yb.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:yb.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:yb.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:yb.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(t){n=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:yb.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function zb(t){if(!(this instanceof zb))return new zb(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=wb.toArray(t.entropy,t.entropyEnc||"hex"),n=wb.toArray(t.nonce,t.nonceEnc||"hex"),r=wb.toArray(t.pers,t.persEnc||"hex");gb(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var Pb=zb;zb.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},zb.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=wb.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var Ub=bb.assert;function Qb(t,e){if(t instanceof Qb)return t;this._importDER(t,e)||(Ub(t.r&&t.s,"Signature without r or s"),this.r=new jg(t.r,16),this.s=new jg(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Yb=Qb;function Wb(){this.place=0}function Fb(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o>>=0;return!(i<=127)&&(e.place=a,i)}function Vb(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}Qb.prototype._importDER=function(t,e){t=bb.toArray(t,e);var n=new Wb;if(48!==t[n.place++])return!1;var r=Fb(t,n);if(!1===r)return!1;if(r+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var i=Fb(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=Fb(t,n);if(!1===a)return!1;if(t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new jg(o),this.s=new jg(s),this.recoveryParam=null,!0},Qb.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=Vb(e),n=Vb(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];Hb(r,e.length),(r=r.concat(e)).push(2),Hb(r,n.length);var i=r.concat(n),o=[48];return Hb(o,i.length),o=o.concat(i),bb.encode(o,t)};var Gb=function(){throw new Error("unsupported")},qb=bb.assert;function Zb(t){if(!(this instanceof Zb))return new Zb(t);"string"==typeof t&&(qb(Object.prototype.hasOwnProperty.call(Ob,t),"Unknown curve "+t),t=Ob[t]),t instanceof Ob.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Jb=Zb;Zb.prototype.keyPair=function(t){return new Rb(this,t)},Zb.prototype.keyFromPrivate=function(t,e){return Rb.fromPrivate(this,t,e)},Zb.prototype.keyFromPublic=function(t,e){return Rb.fromPublic(this,t,e)},Zb.prototype.genKeyPair=function(t){t||(t={});for(var e=new Pb({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||Gb(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new jg(2));;){var i=new jg(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Zb.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Zb.prototype.sign=function(t,e,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new jg(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new Pb({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new jg(1)),c=0;;c++){var l=r.k?r.k(c):new jg(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new Yb({r:f,s:p,recoveryParam:y})}}}}}},Zb.prototype.verify=function(t,e,n,r){t=this._truncateToN(new jg(t,16)),n=this.keyFromPublic(n,r);var i=(e=new Yb(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},Zb.prototype.recoverPubKey=function(t,e,n,r){qb((3&n)===n,"The recovery param is more than two bits"),e=new Yb(e,r);var i=this.n,o=new jg(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},Zb.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new Yb(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var Xb=mb((function(t,e){var n=e;n.version="6.5.4",n.utils=bb,n.rand=function(){throw new Error("unsupported")},n.curve=Db,n.curves=Ob,n.ec=Jb,n.eddsa=null})).ec;const Kb=new sp("signing-key/5.7.0");let $b=null;function tM(){return $b||($b=new Xb("secp256k1")),$b}class eM{constructor(t){Kp(this,"curve","secp256k1"),Kp(this,"privateKey",bp(t)),32!==Mp(this.privateKey)&&Kb.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=tM().keyFromPrivate(pp(this.privateKey));Kp(this,"publicKey","0x"+e.getPublic(!1,"hex")),Kp(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Kp(this,"_isSigningKey",!0)}_addPoint(t){const e=tM().keyFromPublic(pp(this.publicKey)),n=tM().keyFromPublic(pp(t));return"0x"+e.pub.add(n.pub).encodeCompressed("hex")}signDigest(t){const e=tM().keyFromPrivate(pp(this.privateKey)),n=pp(t);32!==n.length&&Kb.throwArgumentError("bad digest length","digest",t);const r=e.sign(n,{canonical:!0});return xp({recoveryParam:r.recoveryParam,r:Ep("0x"+r.r.toString(16),32),s:Ep("0x"+r.s.toString(16),32)})}computeSharedSecret(t){const e=tM().keyFromPrivate(pp(this.privateKey)),n=tM().keyFromPublic(pp(nM(t)));return Ep("0x"+e.derive(n.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function nM(t,e){const n=pp(t);if(32===n.length){const t=new eM(n);return e?"0x"+tM().keyFromPrivate(n).getPublic(!0,"hex"):t.publicKey}return 33===n.length?e?bp(n):"0x"+tM().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?e?"0x"+tM().keyFromPublic(n).getPublic(!0,"hex"):bp(n):Kb.throwArgumentError("invalid public or private key","key","[REDACTED]")}const rM=new sp("transactions/5.7.0");var iM;function oM(t){return"0x"===t?null:Zy(t)}function aM(t){return"0x"===t?cm:Dp.from(t)}function sM(t,e){return function(t){return Zy(Ap(Py(Ap(nM(t),1)),12))}(function(t,e){const n=xp(e),r={r:pp(n.r),s:pp(n.s)};return"0x"+tM().recoverPubKey(pp(t),r,n.recoveryParam).encode("hex",!1)}(pp(t),e))}function uM(t,e){const n=mp(Dp.from(t).toHexString());return n.length>32&&rM.throwArgumentError("invalid length for "+e,"transaction:"+e,t),n}function cM(t,e){return{address:Zy(t),storageKeys:(e||[]).map(((e,n)=>(32!==Mp(e)&&rM.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,e),e.toLowerCase())))}}function lM(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&rM.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),cM(t[0],t[1])):cM(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const n=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return cM(e,Object.keys(n).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function hM(t){return lM(t).map((t=>[t.address,t.storageKeys]))}function dM(t,e){if(null!=t.gasPrice){const e=Dp.from(t.gasPrice),n=Dp.from(t.maxFeePerGas||0);e.eq(n)||rM.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:n})}const n=[uM(t.chainId||0,"chainId"),uM(t.nonce||0,"nonce"),uM(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),uM(t.maxFeePerGas||0,"maxFeePerGas"),uM(t.gasLimit||0,"gasLimit"),null!=t.to?Zy(t.to):"0x",uM(t.value||0,"value"),t.data||"0x",hM(t.accessList||[])];if(e){const t=xp(e);n.push(uM(t.recoveryParam,"recoveryParam")),n.push(mp(t.r)),n.push(mp(t.s))}return Np(["0x02",Qy(n)])}function fM(t,e){const n=[uM(t.chainId||0,"chainId"),uM(t.nonce||0,"nonce"),uM(t.gasPrice||0,"gasPrice"),uM(t.gasLimit||0,"gasLimit"),null!=t.to?Zy(t.to):"0x",uM(t.value||0,"value"),t.data||"0x",hM(t.accessList||[])];if(e){const t=xp(e);n.push(uM(t.recoveryParam,"recoveryParam")),n.push(mp(t.r)),n.push(mp(t.s))}return Np(["0x01",Qy(n)])}function pM(t,e,n){try{const n=aM(e[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");t.v=n}catch(t){rM.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=Ep(e[1],32),t.s=Ep(e[2],32);try{const e=Py(n(t));t.from=sM(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){}}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(iM||(iM={}));var yM=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const mM=new sp("contracts/5.7.0");function gM(t,e){return yM(this,void 0,void 0,(function*(){const n=yield e;"string"!=typeof n&&mM.throwArgumentError("invalid address or ENS name","name",n);try{return Zy(n)}catch(t){}t||mM.throwError("a provider or signer is needed to resolve ENS names",sp.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield t.resolveName(n);return null==r&&mM.throwArgumentError("resolver or addr is not configured for ENS name","name",n),r}))}function vM(t,e,n){return yM(this,void 0,void 0,(function*(){return Array.isArray(n)?yield Promise.all(n.map(((n,r)=>vM(t,Array.isArray(e)?e[r]:e[n.name],n)))):"address"===n.type?yield gM(t,e):"tuple"===n.type?yield vM(t,e,n.components):"array"===n.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>vM(t,e,n.arrayChildren)))):Promise.reject(mM.makeError("invalid value for array",sp.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function wM(t,e,n){return yM(this,void 0,void 0,(function*(){let r={};n.length===e.inputs.length+1&&"object"==typeof n[n.length-1]&&(r=ey(n.pop())),mM.checkArgumentCount(n.length,e.inputs.length,"passed to contract"),t.signer?r.from?r.from=ty({override:gM(t.signer,r.from),signer:t.signer.getAddress()}).then((t=>yM(this,void 0,void 0,(function*(){return Zy(t.signer)!==t.override&&mM.throwError("Contract with a Signer cannot override from",sp.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):r.from=t.signer.getAddress():r.from&&(r.from=gM(t.provider,r.from));const i=yield ty({args:vM(t.signer||t.provider,n,e.inputs),address:t.resolvedAddress,overrides:ty(r)||{}}),o=t.interface.encodeFunctionData(e,i.args),a={data:o,to:i.address},s=i.overrides;if(null!=s.nonce&&(a.nonce=Dp.from(s.nonce).toNumber()),null!=s.gasLimit&&(a.gasLimit=Dp.from(s.gasLimit)),null!=s.gasPrice&&(a.gasPrice=Dp.from(s.gasPrice)),null!=s.maxFeePerGas&&(a.maxFeePerGas=Dp.from(s.maxFeePerGas)),null!=s.maxPriorityFeePerGas&&(a.maxPriorityFeePerGas=Dp.from(s.maxPriorityFeePerGas)),null!=s.from&&(a.from=s.from),null!=s.type&&(a.type=s.type),null!=s.accessList&&(a.accessList=lM(s.accessList)),null==a.gasLimit&&null!=e.gas){let t=21e3;const n=pp(o);for(let e=0;enull!=r[t]));return u.length&&mM.throwError(`cannot override ${u.map((t=>JSON.stringify(t))).join(",")}`,sp.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),a}))}function bM(t,e,n){const r=t.signer||t.provider;return function(...i){return yM(this,void 0,void 0,(function*(){let o;if(i.length===e.inputs.length+1&&"object"==typeof i[i.length-1]){const t=ey(i.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,i.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const a=yield wM(t,e,i),s=yield r.call(a,o);try{let r=t.interface.decodeFunctionResult(e,s);return n&&1===e.outputs.length&&(r=r[0]),r}catch(e){throw e.code===sp.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=i,e.transaction=a),e}}))}}function MM(t,e,n){return e.constant?bM(t,e,n):function(t,e){return function(...n){return yM(this,void 0,void 0,(function*(){t.signer||mM.throwError("sending a transaction requires a signer",sp.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const r=yield wM(t,e,n),i=yield t.signer.sendTransaction(r);return function(t,e){const n=e.wait.bind(e);e.wait=e=>n(e).then((e=>(e.events=e.logs.map((n=>{let r=oy(n),i=null;try{i=t.interface.parseLog(n)}catch(t){}return i&&(r.args=i.args,r.decode=(e,n)=>t.interface.decodeEventLog(i.eventFragment,e,n),r.event=i.name,r.eventSignature=i.signature),r.removeListener=()=>t.provider,r.getBlock=()=>t.provider.getBlock(e.blockHash),r.getTransaction=()=>t.provider.getTransaction(e.transactionHash),r.getTransactionReceipt=()=>Promise.resolve(e),r})),e)))}(t,i),i}))}}(t,e)}function AM(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class NM{constructor(t,e){Kp(this,"tag",t),Kp(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((n=>!(!e&&n.listener===t&&(e=!0,1))))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const n=t.slice();return setTimeout((()=>{e.listener.apply(this,n)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class IM extends NM{constructor(){super("error",null)}}class EM extends NM{constructor(t,e,n,r){const i={address:t};let o=e.getEventTopic(n);r?(o!==r[0]&&mM.throwArgumentError("topic mismatch","topics",r),i.topics=r.slice()):i.topics=[o],super(AM(i),i),Kp(this,"address",t),Kp(this,"interface",e),Kp(this,"fragment",n)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=function(t){const e=[],n=function(t,r){if(Array.isArray(r))for(let i in r){const o=t.slice();o.push(i);try{n(o,r[i])}catch(t){e.push({path:o,error:t})}}};return n([],t),e}(t.args);if(e.length)throw e[0].error;const n=(t.args||[]).slice();return n.push(t),n}}class xM extends NM{constructor(t,e){super("*",{address:t}),Kp(this,"address",t),Kp(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,n)=>this.interface.decodeEventLog(e.eventFragment,t,n),t.args=e.args}catch(t){}}}class kM extends class{constructor(t,e,n){Kp(this,"interface",$p(new.target,"getInterface")(e)),null==n?(Kp(this,"provider",null),Kp(this,"signer",null)):Lg.isSigner(n)?(Kp(this,"provider",n.provider||null),Kp(this,"signer",n)):Ig.isProvider(n)?(Kp(this,"provider",n),Kp(this,"signer",null)):mM.throwArgumentError("invalid signer or provider","signerOrProvider",n),Kp(this,"callStatic",{}),Kp(this,"estimateGas",{}),Kp(this,"functions",{}),Kp(this,"populateTransaction",{}),Kp(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const n=this.interface.events[e];Kp(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(n,t)}))),t[n.name]||(t[n.name]=[]),t[n.name].push(e)})),Object.keys(t).forEach((e=>{const n=t[e];1===n.length?Kp(this.filters,e,this.filters[n[0]]):mM.warn(`Duplicate definition of ${e} (${n.join(", ")})`)}))}if(Kp(this,"_runningEvents",{}),Kp(this,"_wrappedEmits",{}),null==t&&mM.throwArgumentError("invalid contract address or ENS name","addressOrName",t),Kp(this,"address",t),this.provider)Kp(this,"resolvedAddress",gM(this.provider,t));else try{Kp(this,"resolvedAddress",Promise.resolve(Zy(t)))}catch(t){mM.throwError("provider is required to use ENS name as contract address",sp.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((t=>{}));const r={},i={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(i[t])mM.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{i[t]=!0;{const n=e.name;r[`%${n}`]||(r[`%${n}`]=[]),r[`%${n}`].push(t)}null==this[t]&&Kp(this,t,MM(this,e,!0)),null==this.functions[t]&&Kp(this.functions,t,MM(this,e,!1)),null==this.callStatic[t]&&Kp(this.callStatic,t,bM(this,e,!0)),null==this.populateTransaction[t]&&Kp(this.populateTransaction,t,function(t,e){return function(...n){return wM(t,e,n)}}(this,e)),null==this.estimateGas[t]&&Kp(this.estimateGas,t,function(t,e){const n=t.signer||t.provider;return function(...r){return yM(this,void 0,void 0,(function*(){n||mM.throwError("estimate require a provider or signer",sp.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield wM(t,e,r);return yield n.estimateGas(i)}))}}(this,e))}})),Object.keys(r).forEach((t=>{const e=r[t];if(e.length>1)return;t=t.substring(1);const n=e[0];try{null==this[t]&&Kp(this,t,this[n])}catch(t){}null==this.functions[t]&&Kp(this.functions,t,this.functions[n]),null==this.callStatic[t]&&Kp(this.callStatic,t,this.callStatic[n]),null==this.populateTransaction[t]&&Kp(this.populateTransaction,t,this.populateTransaction[n]),null==this.estimateGas[t]&&Kp(this.estimateGas,t,this.estimateGas[n])}))}static getContractAddress(t){return Jy(t)}static getInterface(t){return Mg.isInterface(t)?t:new Mg(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,t).then((t=>("0x"===t&&mM.throwError("contract not deployed",sp.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||mM.throwError("sending a transactions require a signer",sp.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=ey(t||{});return["from","to"].forEach((function(t){null!=e[t]&&mM.throwError("cannot override "+t,sp.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new Sg(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&Kp(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return vg.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new IM);if("event"===t)return this._normalizeRunningEvent(new NM("event",null));if("*"===t)return this._normalizeRunningEvent(new xM(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new EM(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const n=this.interface.getEvent(e);return this._normalizeRunningEvent(new EM(this.address,this.interface,n,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new NM(AM(e),e))}return this._normalizeRunningEvent(new xM(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,n){const r=oy(e);return r.removeListener=()=>{n&&(t.removeListener(n),this._checkRunningEvents(t))},r.getBlock=()=>this.provider.getBlock(e.blockHash),r.getTransaction=()=>this.provider.getTransaction(e.transactionHash),r.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(r),r}_addEventListener(t,e,n){if(this.provider||mM.throwError("events require a provider or a signer with a provider",sp.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,n),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const n=n=>{let r=this._wrapEvent(t,n,e);if(null==r.decodeError)try{const e=t.getEmit(r);this.emit(t.filter,...e)}catch(t){r.decodeError=t.error}null!=t.filter&&this.emit("event",r),null!=r.decodeError&&this.emit("error",r.decodeError,r)};this._wrappedEmits[t.tag]=n,null!=t.filter&&this.provider.on(t.filter,n)}}queryFilter(t,e,n){const r=this._getRunningEvent(t),i=ey(r.filter);return"string"==typeof e&&vp(e,32)?(null!=n&&mM.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),i.blockHash=e):(i.fromBlock=null!=e?e:0,i.toBlock=null!=n?n:"latest"),this.provider.getLogs(i).then((t=>t.map((t=>this._wrapEvent(r,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const n=this._getRunningEvent(t),r=n.run(e)>0;return this._checkRunningEvents(n),r}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const n=this._getRunningEvent(t);return n.removeListener(e),this._checkRunningEvents(n),this}removeListener(t,e){return this.off(t,e)}}{}class TM{constructor(t){Kp(this,"alphabet",t),Kp(this,"base",t.length),Kp(this,"_alphabetMap",{}),Kp(this,"_leader",t.charAt(0));for(let e=0;e0;)n.push(r%this.base),r=r/this.base|0}let r="";for(let t=0;0===e[t]&&t=0;--t)r+=this.alphabet[n[t]];return r}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let n=0;n>=8;for(;i>0;)e.push(255&i),i>>=8}for(let n=0;t[n]===this._leader&&n{o[e.toLowerCase()]=t})):r.headers.keys().forEach((t=>{o[t.toLowerCase()]=r.headers.get(t)})),{headers:o,statusCode:r.status,statusMessage:r.statusText,body:pp(new Uint8Array(i))}}))}const RM=new sp("web/5.7.1");function UM(t){return new Promise((e=>{setTimeout(e,t)}))}function QM(t,e){if(null==t)return null;if("string"==typeof t)return t;if(hp(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return bm(t)}catch(t){}return bp(t)}return t}function YM(t,e,n){let r=null;if(null!=e){r=wm(e);const n="string"==typeof t?{url:t}:ey(t);n.headers?0!==Object.keys(n.headers).filter((t=>"content-type"===t.toLowerCase())).length||(n.headers=ey(n.headers),n.headers["content-type"]="application/json"):n.headers={"content-type":"application/json"},t=n}return function(t,e,n){const r="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;RM.assertArgument(r>0&&r%1==0,"invalid connection throttle limit","connection.throttleLimit",r);const i="object"==typeof t?t.throttleCallback:null,o="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;RM.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const a="object"==typeof t&&!!t.errorPassThrough,s={};let u=null;const c={method:"GET"};let l=!1,h=12e4;if("string"==typeof t)u=t;else if("object"==typeof t){if(null!=t&&null!=t.url||RM.throwArgumentError("missing URL","connection.url",t),u=t.url,"number"==typeof t.timeout&&t.timeout>0&&(h=t.timeout),t.headers)for(const e in t.headers)s[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(l=!0);if(c.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==u.substring(0,6)&&!0!==t.allowInsecureAuthentication&&RM.throwError("basic authentication requires a secure https url",sp.errors.INVALID_ARGUMENT,{argument:"url",url:u,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;s.authorization={key:"Authorization",value:"Basic "+Sm(wm(e))}}null!=t.skipFetchSetup&&(c.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(c.fetchOptions=ey(t.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),f=u?u.match(d):null;if(f)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]||"text/plain"},body:f[2]?Lm(f[3]):(p=f[3],wm(p.replace(/%([0-9a-f][0-9a-f])/gi,((t,e)=>String.fromCharCode(parseInt(e,16))))))};let e=t.body;return n&&(e=n(t.body,t)),Promise.resolve(e)}catch(t){RM.throwError("processing response error",sp.errors.SERVER_ERROR,{body:QM(f[1],f[2]),error:t,requestBody:null,requestMethod:"GET",url:u})}var p;e&&(c.method="POST",c.body=e,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(e.length)}));const y={};Object.keys(s).forEach((t=>{const e=s[t];y[e.key]=e.value})),c.headers=y;const m=function(){let t=null;return{promise:new Promise((function(e,n){h&&(t=setTimeout((()=>{null!=t&&(t=null,n(RM.makeError("timeout",sp.errors.TIMEOUT,{requestBody:QM(c.body,y["content-type"]),requestMethod:c.method,timeout:h,url:u})))}),h))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),g=function(){return function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}(this,void 0,void 0,(function*(){for(let t=0;t=300)&&(m.cancel(),RM.throwError("bad response",sp.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:QM(s,e.headers?e.headers["content-type"]:null),requestBody:QM(c.body,y["content-type"]),requestMethod:c.method,url:u})),n)try{const t=yield n(s,e);return m.cancel(),t}catch(n){if(n.throttleRetry&&t{let r=null;if(null!=t)try{r=JSON.parse(bm(t))}catch(e){RM.throwError("invalid JSON",sp.errors.SERVER_ERROR,{body:t,error:e})}return n&&(r=n(r,e)),r}))}function WM(t,e){return e||(e={}),null==(e=ey(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(n,r){let i=null,o=!1;const a=()=>!o&&(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout((()=>{a()&&r(new Error("timeout"))}),e.timeout));const s=e.retryLimit;let u=0;!function i(){return t().then((function(t){if(void 0!==t)a()&&n(t);else if(e.oncePoll)e.oncePoll.once("poll",i);else if(e.onceBlock)e.onceBlock.once("block",i);else if(!o){if(u++,u>s)return void(a()&&r(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,u)));te.ceiling&&(t=e.ceiling),setTimeout(i,t)}return null}),(function(t){a()&&r(t)}))}()}))}for(var FM="qpzry9x8gf2tvdw0s3jn54khce6mua7l",VM={},HM=0;HM>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function ZM(t){for(var e=1,n=0;n126)return"Invalid prefix ("+t+")";e=qM(e)^r>>5}for(e=qM(e),n=0;n=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<=e)return"Excess padding";if(i<n)throw new TypeError("Exceeds length limit");var r=ZM(t=t.toLowerCase());if("string"==typeof r)throw new Error(r);for(var i=t+"1",o=0;o>5!=0)throw new Error("Non 5-bit word");r=qM(r)^a,i+=FM.charAt(a)}for(o=0;o<6;++o)r=qM(r);for(r^=1,o=0;o<6;++o)i+=FM.charAt(r>>5*(5-o)&31);return i},KM=function(t){var e=JM(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)};const $M="providers/5.7.2",tA=new sp($M);class eA{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),n=this.bigNumber.bind(this),r=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),s=this.number.bind(this),u=this.type.bind(this);return t.transaction={hash:o,type:u,accessList:eA.allowNull(this.accessList.bind(this),null),blockHash:eA.allowNull(o,null),blockNumber:eA.allowNull(s,null),transactionIndex:eA.allowNull(s,null),confirmations:eA.allowNull(s,null),from:e,gasPrice:eA.allowNull(n),maxPriorityFeePerGas:eA.allowNull(n),maxFeePerGas:eA.allowNull(n),gasLimit:n,to:eA.allowNull(e,null),value:n,nonce:s,data:i,r:eA.allowNull(this.uint256),s:eA.allowNull(this.uint256),v:eA.allowNull(s),creates:eA.allowNull(e,null),raw:eA.allowNull(i)},t.transactionRequest={from:eA.allowNull(e),nonce:eA.allowNull(s),gasLimit:eA.allowNull(n),gasPrice:eA.allowNull(n),maxPriorityFeePerGas:eA.allowNull(n),maxFeePerGas:eA.allowNull(n),to:eA.allowNull(e),value:eA.allowNull(n),data:eA.allowNull((t=>this.data(t,!0))),type:eA.allowNull(s),accessList:eA.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:s,blockNumber:s,transactionHash:o,address:e,topics:eA.arrayOf(o),data:i,logIndex:s,blockHash:o},t.receipt={to:eA.allowNull(this.address,null),from:eA.allowNull(this.address,null),contractAddress:eA.allowNull(e,null),transactionIndex:s,root:eA.allowNull(a),gasUsed:n,logsBloom:eA.allowNull(i),blockHash:o,transactionHash:o,logs:eA.arrayOf(this.receiptLog.bind(this)),blockNumber:s,confirmations:eA.allowNull(s,null),cumulativeGasUsed:n,effectiveGasPrice:eA.allowNull(n),status:eA.allowNull(s),type:u},t.block={hash:eA.allowNull(o),parentHash:o,number:s,timestamp:s,nonce:eA.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:eA.allowNull(e),extraData:i,transactions:eA.allowNull(eA.arrayOf(o)),baseFeePerGas:eA.allowNull(n)},t.blockWithTransactions=ey(t.block),t.blockWithTransactions.transactions=eA.allowNull(eA.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:eA.allowNull(r,void 0),toBlock:eA.allowNull(r,void 0),blockHash:eA.allowNull(o,void 0),address:eA.allowNull(e,void 0),topics:eA.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:eA.allowNull(s),blockHash:eA.allowNull(o),transactionIndex:s,removed:eA.allowNull(this.boolean.bind(this)),address:e,data:eA.allowFalsish(i,"0x"),topics:eA.arrayOf(o),transactionHash:o,logIndex:s},t}accessList(t){return lM(t||[])}number(t){return"0x"===t?0:Dp.from(t).toNumber()}type(t){return"0x"===t||null==t?0:Dp.from(t).toNumber()}bigNumber(t){return Dp.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),vp(t))?t.toLowerCase():tA.throwArgumentError("invalid hash","value",t)}data(t,e){const n=this.hex(t,e);if(n.length%2!=0)throw new Error("invalid data; odd-length - "+t);return n}address(t){return Zy(t)}callAddress(t){if(!vp(t,32))return null;const e=Zy(Ap(t,12));return"0x0000000000000000000000000000000000000000"===e?null:e}contractAddress(t){return Jy(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";switch(t){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return t}if("number"==typeof t||vp(t))return Ip(t);throw new Error("invalid blockTag")}hash(t,e){const n=this.hex(t,e);return 32!==Mp(n)?tA.throwArgumentError("invalid hash","value",t):n}difficulty(t){if(null==t)return null;const e=Dp.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!vp(t))throw new Error("invalid uint256");return Ep(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);const n=null!=t._difficulty?t._difficulty:t.difficulty,r=eA.check(e,t);return r._difficulty=null==n?null:Dp.from(n),r}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return eA.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&Dp.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const e=eA.check(this.formats.transaction,t);if(null!=t.chainId){let n=t.chainId;vp(n)&&(n=Dp.from(n).toNumber()),e.chainId=n}else{let n=t.networkId;null==n&&null==e.v&&(n=t.chainId),vp(n)&&(n=Dp.from(n).toNumber()),"number"!=typeof n&&null!=e.v&&(n=(e.v-35)/2,n<0&&(n=0),n=parseInt(n)),"number"!=typeof n&&(n=0),e.chainId=n}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return function(t){const e=pp(t);if(e[0]>127)return function(t){const e=Fy(t);9!==e.length&&6!==e.length&&rM.throwArgumentError("invalid raw transaction","rawTransaction",t);const n={nonce:aM(e[0]).toNumber(),gasPrice:aM(e[1]),gasLimit:aM(e[2]),to:oM(e[3]),value:aM(e[4]),data:e[5],chainId:0};if(6===e.length)return n;try{n.v=Dp.from(e[6]).toNumber()}catch(t){return n}if(n.r=Ep(e[7],32),n.s=Ep(e[8],32),Dp.from(n.r).isZero()&&Dp.from(n.s).isZero())n.chainId=n.v,n.v=0;else{n.chainId=Math.floor((n.v-35)/2),n.chainId<0&&(n.chainId=0);let r=n.v-27;const i=e.slice(0,6);0!==n.chainId&&(i.push(bp(n.chainId)),i.push("0x"),i.push("0x"),r-=2*n.chainId+8);const o=Py(Qy(i));try{n.from=sM(o,{r:bp(n.r),s:bp(n.s),recoveryParam:r})}catch(t){}n.hash=Py(t)}return n.type=null,n}(e);switch(e[0]){case 1:return function(t){const e=Fy(t.slice(1));8!==e.length&&11!==e.length&&rM.throwArgumentError("invalid component count for transaction type: 1","payload",bp(t));const n={type:1,chainId:aM(e[0]).toNumber(),nonce:aM(e[1]).toNumber(),gasPrice:aM(e[2]),gasLimit:aM(e[3]),to:oM(e[4]),value:aM(e[5]),data:e[6],accessList:lM(e[7])};return 8===e.length||(n.hash=Py(t),pM(n,e.slice(8),fM)),n}(e);case 2:return function(t){const e=Fy(t.slice(1));9!==e.length&&12!==e.length&&rM.throwArgumentError("invalid component count for transaction type: 2","payload",bp(t));const n=aM(e[2]),r=aM(e[3]),i={type:2,chainId:aM(e[0]).toNumber(),nonce:aM(e[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:aM(e[4]),to:oM(e[5]),value:aM(e[6]),data:e[7],accessList:lM(e[8])};return 9===e.length||(i.hash=Py(t),pM(i,e.slice(9),dM)),i}(e)}return rM.throwError(`unsupported transaction type: ${e[0]}`,sp.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}(t)}receiptLog(t){return eA.check(this.formats.receiptLog,t)}receipt(t){const e=eA.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=Dp.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&tA.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):tA.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&tA.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map((t=>this.topics(t))):null!=t?this.hash(t,!0):null}filter(t){return eA.check(this.formats.filter,t)}filterLog(t){return eA.check(this.formats.filterLog,t)}static check(t,e){const n={};for(const r in t)try{const i=t[r](e[r]);void 0!==i&&(n[r]=i)}catch(t){throw t.checkKey=r,t.checkValue=e[r],t}return n}static allowNull(t,e){return function(n){return null==n?e:t(n)}}static allowFalsish(t,e){return function(n){return n?t(n):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const n=[];return e.forEach((function(e){n.push(t(e))})),n}}}var nA=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const rA=new sp($M);function iA(t){return null==t?"null":(32!==Mp(t)&&rA.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function oA(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map((t=>{if(Array.isArray(t)){const e={};t.forEach((t=>{e[iA(t)]=!0}));const n=Object.keys(e);return n.sort(),n.join("|")}return iA(t)})).join("&")}function aA(t){if("string"==typeof t){if(32===Mp(t=t.toLowerCase()))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+oA(t);if(Ng.isForkEvent(t))throw rA.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+oA(t.topics||[])}throw new Error("invalid event - "+t)}function sA(){return(new Date).getTime()}function uA(t){return new Promise((e=>{setTimeout(e,t)}))}const cA=["block","network","pending","poll"];class lA{constructor(t,e,n){Kp(this,"tag",t),Kp(this,"listener",e),Kp(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],n=""===(r=t[2])?[]:r.split(/&/g).map((t=>{if(""===t)return[];const e=t.split("|").map((t=>"null"===t?null:t));return 1===e.length?e[0]:e}));var r;const i={};return n.length>0&&(i.topics=n),e&&"*"!==e&&(i.address=e),i}pollable(){return this.tag.indexOf(":")>=0||cA.indexOf(this.tag)>=0}}const hA={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function dA(t){return Ep(Dp.from(t).toHexString(),32)}function fA(t){return LM.encode(yp([t,Ap(SM(SM(t)),0,4)]))}const pA=new RegExp("^(ipfs)://(.*)$","i"),yA=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),pA,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function mA(t,e){try{return bm(gA(t,e))}catch(t){}return null}function gA(t,e){if("0x"===t)return null;const n=Dp.from(Ap(t,e,e+32)).toNumber(),r=Dp.from(Ap(t,n,n+32)).toNumber();return Ap(t,n+32,n+32+r)}function vA(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):rA.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function wA(t){const e=pp(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function bA(t){if(t.length%32==0)return t;const e=new Uint8Array(32*Math.ceil(t.length/32));return e.set(t),e}function MA(t){const e=[];let n=0;for(let r=0;rDp.from(t).eq(1))).catch((t=>{if(t.code===sp.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t}))),this._supportsEip2544}_fetch(t,e){return nA(this,void 0,void 0,(function*(){const n={to:this.address,ccipReadEnabled:!0,data:Np([t,Km(this.name),e||"0x"])};let r=!1;var i;(yield this.supportsWildcard())&&(r=!0,n.data=Np(["0x9061b923",MA([(i=this.name,bp(yp(Xm(i).map((t=>{if(t.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const e=new Uint8Array(t.length+1);return e.set(t,1),e[0]=e.length-1,e}))))+"00"),n.data])]));try{let t=yield this.provider.call(n);return pp(t).length%32==4&&rA.throwError("resolver threw error",sp.errors.CALL_EXCEPTION,{transaction:n,data:t}),r&&(t=gA(t,0)),t}catch(t){if(t.code===sp.errors.CALL_EXCEPTION)return null;throw t}}))}_fetchBytes(t,e){return nA(this,void 0,void 0,(function*(){const n=yield this._fetch(t,e);return null!=n?gA(n,0):null}))}_getAddress(t,e){const n=hA[String(t)];if(null==n&&rA.throwError(`unsupported coin type: ${t}`,sp.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===n.ilk)return this.provider.formatter.address(e);const r=pp(e);if(null!=n.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return fA(yp([[n.p2pkh],"0x"+t[2]]))}}if(null!=n.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return fA(yp([[n.p2sh],"0x"+t[2]]))}}if(null!=n.prefix){const t=r[1];let e=r[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&r.length===2+t&&t>=1&&t<=75){const t=KM(r.slice(2));return t.unshift(e),XM(n.prefix,t)}}return null}getAddress(t){return nA(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t)try{const t=yield this._fetch("0x3b3b57de");return"0x"===t||"0x0000000000000000000000000000000000000000000000000000000000000000"===t?null:this.provider.formatter.callAddress(t)}catch(t){if(t.code===sp.errors.CALL_EXCEPTION)return null;throw t}const e=yield this._fetchBytes("0xf1cb7e06",dA(t));if(null==e||"0x"===e)return null;const n=this._getAddress(t,e);return null==n&&rA.throwError("invalid or unsupported coin data",sp.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),n}))}getAvatar(){return nA(this,void 0,void 0,(function*(){const t=[{type:"name",content:this.name}];try{const e=yield this.getText("avatar");if(null==e)return null;for(let n=0;nt[e]))}return rA.throwError("invalid or unsupported content hash data",sp.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})}))}getText(t){return nA(this,void 0,void 0,(function*(){let e=wm(t);e=yp([dA(64),dA(e.length),e]),e.length%32!=0&&(e=yp([e,Ep("0x",32-t.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",bp(e));return null==n||"0x"===n?null:bm(n)}))}}let NA=null,IA=1;class EA extends Ig{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Kp(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch((t=>{})),this._ready().catch((t=>{}));else{const e=$p(new.target,"getNetwork")(t);e?(Kp(this,"_network",e),this.emit("network",e,null)):rA.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return nA(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||rA.throwError("no network detected",sp.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:Kp(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return WM((()=>this._ready().then((t=>t),(t=>{if(t.code!==sp.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))))}static getFormatter(){return null==NA&&(NA=new eA),NA}static getNetwork(t){return function(t){if(null==t)return null;if("number"==typeof t){for(const e in _M){const n=_M[e];if(n.chainId===t)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){const e=_M[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}const e=_M[t.name];if(!e)return"number"!=typeof t.chainId&&jM.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&jM.throwArgumentError("network chainId mismatch","network",t);let n=t._defaultProvider||null;var r;return null==n&&e._defaultProvider&&(n=(r=e._defaultProvider)&&"function"==typeof r.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:n}}(null==t?"homestead":t)}ccipReadFetch(t,e,n){return nA(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===n.length)return null;const r=t.to.toLowerCase(),i=e.toLowerCase(),o=[];for(let t=0;t=0?null:JSON.stringify({data:i,sender:r}),u=yield YM({url:a,errorPassThrough:!0},s,((t,e)=>(t.status=e.statusCode,t)));if(u.data)return u.data;const c=u.message||"unknown error";if(u.status>=400&&u.status<500)return rA.throwError(`response not found during CCIP fetch: ${c}`,sp.errors.SERVER_ERROR,{url:e,errorMessage:c});o.push(c)}return rA.throwError(`error encountered during CCIP fetch: ${o.map((t=>JSON.stringify(t))).join(", ")}`,sp.errors.SERVER_ERROR,{urls:n,errorMessages:o})}))}_getInternalBlockNumber(t){return nA(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const n=yield e;if(sA()-n.respTime<=t)return n.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=sA(),n=ty({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((t=>null),(t=>t))}).then((({blockNumber:t,networkError:r})=>{if(r)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),r;const i=sA();return(t=Dp.from(t).toNumber()){this._internalBlockNumber===n&&(this._internalBlockNumber=null)})),(yield n).blockNumber}))}poll(){return nA(this,void 0,void 0,(function*(){const t=IA++,e=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(n),this.emit("poll",t,n),n!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)rA.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",rA.makeError("network block skew detected",sp.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let t=this._emitted.block+1;t<=n;t++)this.emit("block",t);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&n-e>12&&delete this._emitted[t]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((t=>{switch(t.type){case"tx":{const n=t.hash;let r=this.getTransactionReceipt(n).then((t=>t&&null!=t.blockNumber?(this._emitted["t:"+n]=t.blockNumber,this.emit(n,t),null):null)).catch((t=>{this.emit("error",t)}));e.push(r);break}case"filter":if(!t._inflight){t._inflight=!0,-2===t._lastBlockNumber&&(t._lastBlockNumber=n-1);const r=t.filter;r.fromBlock=t._lastBlockNumber+1,r.toBlock=n;const i=r.toBlock-this._maxFilterBlockRange;i>r.fromBlock&&(r.fromBlock=i),r.fromBlock<0&&(r.fromBlock=0);const o=this.getLogs(r).then((e=>{t._inflight=!1,0!==e.length&&e.forEach((e=>{e.blockNumber>t._lastBlockNumber&&(t._lastBlockNumber=e.blockNumber),this._emitted["b:"+e.blockHash]=e.blockNumber,this._emitted["t:"+e.transactionHash]=e.blockNumber,this.emit(r,e)}))})).catch((e=>{this.emit("error",e),t._inflight=!1}));e.push(o)}}})),this._lastBlockNumber=n,Promise.all(e).then((()=>{this.emit("didPoll",t)})).catch((t=>{this.emit("error",t)}))}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return nA(this,void 0,void 0,(function*(){return rA.throwError("provider does not support network detection",sp.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return nA(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",e,t),yield uA(0),this._network;const n=rA.makeError("underlying network changed",sp.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",n),n}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((t=>{this._setFastBlockNumber(t)}),(t=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const t=sA();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&tthis._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,n){return nA(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,n||0,null)}))}_waitForTransaction(t,e,n,r){return nA(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(t);return(i?i.confirmations:0)>=e?i:new Promise(((i,o)=>{const a=[];let s=!1;const u=function(){return!!s||(s=!0,a.forEach((t=>{t()})),!1)},c=t=>{t.confirmations{this.removeListener(t,c)})),r){let n=r.startBlock,i=null;const c=a=>nA(this,void 0,void 0,(function*(){s||(yield uA(1e3),this.getTransactionCount(r.from).then((l=>nA(this,void 0,void 0,(function*(){if(!s){if(l<=r.nonce)n=a;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==i&&(i=n-3,i{s||this.once("block",c)})))}));if(s)return;this.once("block",c),a.push((()=>{this.removeListener("block",c)}))}if("number"==typeof n&&n>0){const t=setTimeout((()=>{u()||o(rA.makeError("timeout exceeded",sp.errors.TIMEOUT,{timeout:n}))}),n);t.unref&&t.unref(),a.push((()=>{clearTimeout(t)}))}}))}))}getBlockNumber(){return nA(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return Dp.from(t)}catch(e){return rA.throwError("bad result from backend",sp.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield ty({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getBalance",n);try{return Dp.from(r)}catch(t){return rA.throwError("bad result from backend",sp.errors.SERVER_ERROR,{method:"getBalance",params:n,result:r,error:t})}}))}getTransactionCount(t,e){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield ty({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getTransactionCount",n);try{return Dp.from(r).toNumber()}catch(t){return rA.throwError("bad result from backend",sp.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:r,error:t})}}))}getCode(t,e){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield ty({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getCode",n);try{return bp(r)}catch(t){return rA.throwError("bad result from backend",sp.errors.SERVER_ERROR,{method:"getCode",params:n,result:r,error:t})}}))}getStorageAt(t,e,n){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield ty({address:this._getAddress(t),blockTag:this._getBlockTag(n),position:Promise.resolve(e).then((t=>Ip(t)))}),i=yield this.perform("getStorageAt",r);try{return bp(i)}catch(t){return rA.throwError("bad result from backend",sp.errors.SERVER_ERROR,{method:"getStorageAt",params:r,result:i,error:t})}}))}_wrapTransaction(t,e,n){if(null!=e&&32!==Mp(e))throw new Error("invalid response - sendTransaction");const r=t;return null!=e&&t.hash!==e&&rA.throwError("Transaction hash mismatch from Provider.sendTransaction.",sp.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),r.wait=(e,r)=>nA(this,void 0,void 0,(function*(){let i;null==e&&(e=1),null==r&&(r=0),0!==e&&null!=n&&(i={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:n});const o=yield this._waitForTransaction(t.hash,e,r,i);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&rA.throwError("transaction failed",sp.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),r}sendTransaction(t){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then((t=>bp(t))),n=this.formatter.transaction(t);null==n.confirmations&&(n.confirmations=0);const r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(n,t,r)}catch(t){throw t.transaction=n,t.transactionHash=n.hash,t}}))}_getTransactionRequest(t){return nA(this,void 0,void 0,(function*(){const e=yield t,n={};return["from","to"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?this._getAddress(t):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?Dp.from(t):null)))})),["type"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>null!=t?t:null)))})),e.accessList&&(n.accessList=this.formatter.accessList(e.accessList)),["data"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?bp(t):null)))})),this.formatter.transactionRequest(yield ty(n))}))}_getFilter(t){return nA(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach((n=>{null!=t[n]&&(e[n]=t[n])})),["fromBlock","toBlock"].forEach((n=>{null!=t[n]&&(e[n]=this._getBlockTag(t[n]))})),this.formatter.filter(yield ty(e))}))}_call(t,e,n){return nA(this,void 0,void 0,(function*(){n>=10&&rA.throwError("CCIP read exceeded maximum redirections",sp.errors.SERVER_ERROR,{redirects:n,transaction:t});const r=t.to,i=yield this.perform("call",{transaction:t,blockTag:e});if(n>=0&&"latest"===e&&null!=r&&"0x556f1830"===i.substring(0,10)&&Mp(i)%32==4)try{const o=Ap(i,4),a=Ap(o,0,32);Dp.from(a).eq(r)||rA.throwError("CCIP Read sender did not match",sp.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i});const s=[],u=Dp.from(Ap(o,32,64)).toNumber(),c=Dp.from(Ap(o,u,u+32)).toNumber(),l=Ap(o,u+32);for(let e=0;enA(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",r);if(null==t)return null!=r.blockHash&&null==this._emitted["b:"+r.blockHash]||null!=r.blockTag&&n>this._emitted.block?null:void 0;if(e){let e=null;for(let n=0;nthis._wrapTransaction(t))),n}return this.formatter.block(t)}))),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return nA(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return WM((()=>nA(this,void 0,void 0,(function*(){const n=yield this.perform("getTransaction",e);if(null==n)return null==this._emitted["t:"+t]?null:void 0;const r=this.formatter.transactionResponse(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;t<=0&&(t=1),r.confirmations=t}return this._wrapTransaction(r)}))),{oncePoll:this})}))}getTransactionReceipt(t){return nA(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return WM((()=>nA(this,void 0,void 0,(function*(){const n=yield this.perform("getTransactionReceipt",e);if(null==n)return null==this._emitted["t:"+t]?null:void 0;if(null==n.blockHash)return;const r=this.formatter.receipt(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;t<=0&&(t=1),r.confirmations=t}return r}))),{oncePoll:this})}))}getLogs(t){return nA(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield ty({filter:this._getFilter(t)}),n=yield this.perform("getLogs",e);return n.forEach((t=>{null==t.removed&&(t.removed=!1)})),eA.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)}))}getEtherPrice(){return nA(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return nA(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&rA.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return nA(this,void 0,void 0,(function*(){let e=t;for(;;){if(""===e||"."===e)return null;if("eth"!==t&&"eth"===e)return null;const n=yield this._getResolver(e,"getResolver");if(null!=n){const r=new AA(this,n,t);return e===t||(yield r.supportsWildcard())?r:null}e=e.split(".").slice(1).join(".")}}))}_getResolver(t,e){return nA(this,void 0,void 0,(function*(){null==e&&(e="ENS");const n=yield this.getNetwork();n.ensAddress||rA.throwError("network does not support ENS",sp.errors.UNSUPPORTED_OPERATION,{operation:e,network:n.name});try{const e=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+Km(t).substring(2)});return this.formatter.callAddress(e)}catch(t){}return null}))}resolveName(t){return nA(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if(vp(t))throw e}"string"!=typeof t&&rA.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return nA(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(e,"lookupAddress");if(null==n)return null;const r=mA(yield this.call({to:n,data:"0x691f3431"+Km(e).substring(2)}),0);return(yield this.resolveName(r))!=t?null:r}))}getAvatar(t){return nA(this,void 0,void 0,(function*(){let e=null;if(vp(t)){const n=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(n,"getAvatar");if(!r)return null;e=new AA(this,r,n);try{const t=yield e.getAvatar();if(t)return t.url}catch(t){if(t.code!==sp.errors.CALL_EXCEPTION)throw t}try{const t=mA(yield this.call({to:r,data:"0x691f3431"+Km(n).substring(2)}),0);e=yield this.getResolver(t)}catch(t){if(t.code!==sp.errors.CALL_EXCEPTION)throw t;return null}}else if(e=yield this.getResolver(t),!e)return null;const n=yield e.getAvatar();return null==n?null:n.url}))}perform(t,e){return rA.throwError(t+" not implemented",sp.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_stopEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_addEventListener(t,e,n){const r=new lA(aA(t),e,n);return this._events.push(r),this._startEvent(r),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let n=!1,r=[],i=aA(t);return this._events=this._events.filter((t=>t.tag!==i||(setTimeout((()=>{t.listener.apply(this,e)}),0),n=!0,!t.once||(r.push(t),!1)))),r.forEach((t=>{this._stopEvent(t)})),n}listenerCount(t){if(!t)return this._events.length;let e=aA(t);return this._events.filter((t=>t.tag===e)).length}listeners(t){if(null==t)return this._events.map((t=>t.listener));let e=aA(t);return this._events.filter((t=>t.tag===e)).map((t=>t.listener))}off(t,e){if(null==e)return this.removeAllListeners(t);const n=[];let r=!1,i=aA(t);return this._events=this._events.filter((t=>t.tag!==i||t.listener!=e||!!r||(r=!0,n.push(t),!1))),n.forEach((t=>{this._stopEvent(t)})),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const n=aA(t);this._events=this._events.filter((t=>t.tag!==n||(e.push(t),!1)))}return e.forEach((t=>{this._stopEvent(t)})),this}}var xA=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const kA=new sp($M),TA=["call","estimateGas"];function LA(t,e){if(null==t)return null;if("string"==typeof t.message&&t.message.match("reverted")){const n=vp(t.data)?t.data:null;if(!e||n)return{message:t.message,data:n}}if("object"==typeof t){for(const n in t){const r=LA(t[n],e);if(r)return r}return null}if("string"==typeof t)try{return LA(JSON.parse(t),e)}catch(t){}return null}function SA(t,e,n){const r=n.transaction||n.signedTransaction;if("call"===t){const t=LA(e,!0);if(t)return t.data;kA.throwError("missing revert data in call exception; Transaction reverted without a reason string",sp.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if("estimateGas"===t){let n=LA(e.body,!1);null==n&&(n=LA(e,!1)),n&&kA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",sp.errors.UNPREDICTABLE_GAS_LIMIT,{reason:n.message,method:t,transaction:r,error:e})}let i=e.message;throw e.code===sp.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?i=e.error.message:"string"==typeof e.body?i=e.body:"string"==typeof e.responseText&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&kA.throwError("insufficient funds for intrinsic transaction cost",sp.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),i.match(/nonce (is )?too low/i)&&kA.throwError("nonce has already been used",sp.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&kA.throwError("replacement fee too low",sp.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),i.match(/only replay-protected/i)&&kA.throwError("legacy pre-eip-155 transactions not supported",sp.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:r}),TA.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&kA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",sp.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}function jA(t){return new Promise((function(e){setTimeout(e,t)}))}function CA(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function DA(t){return t?t.toLowerCase():t}const OA={};class zA extends Lg{constructor(t,e,n){if(super(),t!==OA)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Kp(this,"provider",e),null==n&&(n=0),"string"==typeof n?(Kp(this,"_address",this.provider.formatter.address(n)),Kp(this,"_index",null)):"number"==typeof n?(Kp(this,"_index",n),Kp(this,"_address",null)):kA.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(t){return kA.throwError("cannot alter JSON-RPC Signer connection",sp.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new PA(OA,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((t=>(t.length<=this._index&&kA.throwError("unknown account #"+this._index,sp.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index]))))}sendUncheckedTransaction(t){t=ey(t);const e=this.getAddress().then((t=>(t&&(t=t.toLowerCase()),t)));if(null==t.gasLimit){const n=ey(t);n.from=e,t.gasLimit=this.provider.estimateGas(n)}return null!=t.to&&(t.to=Promise.resolve(t.to).then((t=>xA(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.provider.resolveName(t);return null==e&&kA.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))))),ty({tx:ty(t),sender:e}).then((({tx:e,sender:n})=>{null!=e.from?e.from.toLowerCase()!==n&&kA.throwArgumentError("from address mismatch","transaction",t):e.from=n;const r=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[r]).then((t=>t),(t=>("string"==typeof t.message&&t.message.match(/user denied/i)&&kA.throwError("user rejected transaction",sp.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:e}),SA("sendTransaction",t,r))))}))}signTransaction(t){return kA.throwError("signing transactions is unsupported",sp.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return xA(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(t);try{return yield WM((()=>xA(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(n);if(null!==t)return this.provider._wrapTransaction(t,n,e)}))),{oncePoll:this.provider})}catch(t){throw t.transactionHash=n,t}}))}signMessage(t){return xA(this,void 0,void 0,(function*(){const e="string"==typeof t?wm(t):t,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[bp(e),n.toLowerCase()])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&kA.throwError("user rejected signing",sp.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:t}),e}}))}_legacySignMessage(t){return xA(this,void 0,void 0,(function*(){const e="string"==typeof t?wm(t):t,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),bp(e)])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&kA.throwError("user rejected signing",sp.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:t}),e}}))}_signTypedData(t,e,n){return xA(this,void 0,void 0,(function*(){const r=yield fg.resolveNames(t,e,n,(t=>this.provider.resolveName(t))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(fg.getPayload(r.domain,e,r.value))])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&kA.throwError("user rejected signing",sp.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:r.domain,types:e,value:r.value}}),t}}))}unlock(t){return xA(this,void 0,void 0,(function*(){const e=this.provider,n=yield this.getAddress();return e.send("personal_unlockAccount",[n.toLowerCase(),t,null])}))}}class PA extends zA{sendTransaction(t){return this.sendUncheckedTransaction(t).then((t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)})))}}const _A={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class BA extends EA{constructor(t,e){let n=e;null==n&&(n=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then((e=>{t(e)}),(t=>{e(t)}))}),0)}))),super(n),t||(t=$p(this.constructor,"defaultUrl")()),Kp(this,"connection","string"==typeof t?Object.freeze({url:t}):Object.freeze(ey(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return xA(this,void 0,void 0,(function*(){yield jA(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=$p(this.constructor,"getNetwork");try{return e(Dp.from(t).toNumber())}catch(e){return kA.throwError("could not detect network",sp.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return kA.throwError("could not detect network",sp.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new zA(OA,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((t=>t.map((t=>this.formatter.address(t)))))}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:oy(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(r&&this._cache[t])return this._cache[t];const i=YM(this.connection,JSON.stringify(n),CA).then((t=>(this.emit("debug",{action:"response",request:n,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:n,provider:this}),t}));return r&&(this._cache[t]=i,setTimeout((()=>{this._cache[t]=null}),0)),i}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[DA(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[DA(e.address),e.blockTag]];case"getCode":return["eth_getCode",[DA(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[DA(e.address),Ep(e.position,32),e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[$p(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[$p(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=DA(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return xA(this,void 0,void 0,(function*(){if("call"===t||"estimateGas"===t){const t=e.transaction;if(t&&null!=t.type&&Dp.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const n=yield this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&((e=ey(e)).transaction=ey(t),delete e.transaction.type)}}const n=this.prepareRequest(t,e);null==n&&kA.throwError(t+" not implemented",sp.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(n[0],n[1])}catch(n){return SA(t,n,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(n){return function r(){t.send("eth_getFilterChanges",[n]).then((function(n){if(t._pendingFilter!=e)return null;let r=Promise.resolve();return n.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",r=r.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),r.then((function(){return jA(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){r()}),0),null;t.send("eth_uninstallFilter",[n])})).catch((t=>{}))}(),n})).catch((t=>{}))}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const n=ey(_A);if(e)for(const t in e)e[t]&&(n[t]=!0);var r,i;i=n,(r=t)&&"object"==typeof r||Xp.throwArgumentError("invalid object","object",r),Object.keys(r).forEach((t=>{i[t]||Xp.throwArgumentError("invalid object key - "+t,"transaction:"+t,r)}));const o={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(e){if(null==t[e])return;const n=Ip(Dp.from(t[e]));"gasLimit"===e&&(e="gas"),o[e]=n})),["from","to","data"].forEach((function(e){null!=t[e]&&(o[e]=bp(t[e]))})),t.accessList&&(o.accessList=lM(t.accessList)),o}}const RA=new sp($M);let UA=1;function QA(t,e){const n="Web3LegacyFetcher";return function(t,r){const i={method:t,params:r,id:UA++,jsonrpc:"2.0"};return new Promise(((t,r)=>{this.emit("debug",{action:"request",fetcher:n,request:oy(i),provider:this}),e(i,((e,o)=>{if(e)return this.emit("debug",{action:"response",fetcher:n,error:e,request:i,provider:this}),r(e);if(this.emit("debug",{action:"response",fetcher:n,request:i,response:o,provider:this}),o.error){const t=new Error(o.error.message);return t.code=o.error.code,t.data=o.error.data,r(t)}t(o.result)}))}))}}class YA extends BA{constructor(t,e){null==t&&RA.throwArgumentError("missing provider","provider",t);let n=null,r=null,i=null;"function"==typeof t?(n="unknown:",r=t):(n=t.host||t.path||"",!n&&t.isMetaMask&&(n="metamask"),i=t,t.request?(""===n&&(n="eip-1193:"),r=function(t){return function(e,n){null==n&&(n=[]);const r={method:e,params:n};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:oy(r),provider:this}),t.request(r).then((t=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:t,provider:this}),t}))}}(t)):t.sendAsync?r=QA(0,t.sendAsync.bind(t)):t.send?r=QA(0,t.send.bind(t)):RA.throwArgumentError("unsupported provider","provider",t),n||(n="unknown:")),super(n,e),Kp(this,"jsonRpcFetchFunc",r),Kp(this,"provider",i)}send(t,e){return this.jsonRpcFetchFunc(t,e)}}const WA=new RegExp("^bytes([0-9]+)$"),FA=new RegExp("^(u?int)([0-9]*)$"),VA=new RegExp("^(.*)\\[([0-9]*)\\]$"),HA=new sp("solidity/5.7.0");function GA(t,e,n){switch(t){case"address":return n?gp(e,32):pp(e);case"string":return wm(e);case"bytes":return pp(e);case"bool":return e=e?"0x01":"0x00",n?gp(e,32):pp(e)}let r=t.match(FA);if(r){let i=parseInt(r[2]||"256");return(r[2]&&String(i)!==r[2]||i%8!=0||0===i||i>256)&&HA.throwArgumentError("invalid number type","type",t),n&&(i=256),gp(e=Dp.from(e).toTwos(i),i/8)}if(r=t.match(WA),r){const i=parseInt(r[1]);return(String(i)!==r[1]||0===i||i>32)&&HA.throwArgumentError("invalid bytes type","type",t),pp(e).byteLength!==i&&HA.throwArgumentError(`invalid value for ${t}`,"value",e),n?pp((e+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):e}if(r=t.match(VA),r&&Array.isArray(e)){const n=r[1];parseInt(r[2]||String(e.length))!=e.length&&HA.throwArgumentError(`invalid array length for ${t}`,"value",e);const i=[];return e.forEach((function(t){i.push(GA(n,t,!0))})),yp(i)}return HA.throwArgumentError("invalid type","type",t)}function qA(t,e){t.length!=e.length&&HA.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const n=[];return t.forEach((function(t,r){n.push(GA(t,e[r]))})),bp(yp(n))}const ZA=new sp("units/5.7.0"),JA=["wei","kwei","mwei","gwei","szabo","finney","ether"];function XA(t,e){if("string"==typeof e){const t=JA.indexOf(e);-1!==t&&(e=3*t)}return Vp(t,null!=e?e:18)}function KA(t,e){if("string"!=typeof t&&ZA.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=JA.indexOf(e);-1!==t&&(e=3*t)}return Hp(t,null!=e?e:18)}let $A,tN=()=>$A||($A="object"==typeof r?r:window,$A);const eN=()=>(void 0===tN()._Web3ClientConfiguration&&(tN()._Web3ClientConfiguration={}),tN()._Web3ClientConfiguration);function nN(t){let e,n=t[0],r=1;for(;rn.call(e,...t))),e=void 0)}return n}class rN extends BA{constructor(t,e,n,r){super(t),this._network=e,this._endpoint=t,this._endpoints=n,this._failover=r,this._pendingBatch=[]}detectNetwork(){return Promise.resolve(zf.findByName(this._network).id)}requestChunk(t,e,n){try{const r=t.map((t=>t.request));return YM(e,JSON.stringify(r)).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(nN([r,"optionalAccess",t=>t.error])){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else nN([r,"optionalAccess",t=>t.result])?t.resolve(r.result):t.reject()}))})).catch((e=>{if(n<3&&e&&"SERVER_ERROR"==e.code){const e=this._endpoints.indexOf(this._endpoint)+1;this._failover(),this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this.requestChunk(t,this._endpoint,n+1)}else t.forEach((t=>{t.reject(e)}))}))}catch(e){t.forEach((t=>{t.reject()}))}}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const e=[];for(let n=0;n(t.map((t=>t.request)),this.requestChunk(t,this._endpoint,1))))}),eN().batchInterval||10)),i}}const iN=()=>(null==tN()._Web3ClientProviders&&(tN()._Web3ClientProviders={}),tN()._Web3ClientProviders),oN=(t,e)=>{void 0===iN()[t]&&(iN()[t]=[]);const n=iN()[t].indexOf(e);n>-1&&iN()[t].splice(n,1),iN()[t].unshift(e)},aN=async(t,e,n=!0)=>{let r;iN()[t]=e.map(((r,i)=>new rN(r,t,e,(()=>{1===iN()[t].length?aN(t,e,n):iN()[t].splice(i,1)}))));let i=tN();if(null==i.fetch||void 0!==k&&k.env&&"test"==k.env.NODE_ENV||void 0!==i.cy||!1===n)r=iN()[t][0];else{let n=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();if(setTimeout((()=>e(900)),900),!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},referrer:"",referrerPolicy:"no-referrer",body:JSON.stringify({method:"net_version",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const i=Math.min(...n),o=n.indexOf(i);r=iN()[t][o]}oN(t,r)};var sN={getProvider:async t=>{let e=iN();if(e&&e[t])return e[t][0];let n=tN();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[t]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[t]=new Promise((async e=>{await aN(t,zf[t].endpoints),e(tN()._Web3ClientProviders[t][0])}))),await n._Web3ClientGetProviderPromise[t]},getProviders:async t=>{let e=iN();if(e&&e[t])return e[t];let n=tN();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[t]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[t]=new Promise((async e=>{await aN(t,zf[t].endpoints),e(tN()._Web3ClientProviders[t])}))),await n._Web3ClientGetProvidersPromise[t]},setProviderEndpoints:aN,setProvider:oN};class uN extends Ql{constructor(t,e,n,r){super(t),this._provider=new Ql(t),this._network=e,this._endpoint=t,this._endpoints=n,this._failover=r,this._pendingBatch=[],this._rpcRequest=this._rpcRequestReplacement.bind(this)}handleError(t,e,n){if(e<3&&t&&["Failed to fetch","limit reached","504","503","502","500","429","426","422","413","409","408","406","405","404","403","402","401","400"].some((e=>t.toString().match(e)))){const t=this._endpoints.indexOf(this._endpoint)+1;this._endpoint=t>=this._endpoints.length?this._endpoints[0]:this._endpoints[t],this._provider=new Ql(this._endpoint),this.requestChunk(n,e+1)}else n.forEach((e=>{e.reject(t)}))}batchRequest(t,e){return new Promise(((e,n)=>{0===t.length&&e([]);const r=t.map((t=>this._rpcClient.request(t.methodName,t.args)));fetch(this._endpoint,{method:"POST",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}}).then((t=>{t.ok?t.json().then((t=>{e(t)})).catch(n):n(`${t.status} ${t.text}`)})).catch(n)}))}requestChunk(t,e){const n=t.map((t=>t.request));try{return this.batchRequest(n,e).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(function(t){let e,n=t[0],r=1;for(;rn.call(e,...t))),e=void 0)}return n}([r,"optionalAccess",t=>t.error])){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else r?t.resolve(r):t.reject()}))})).catch((n=>this.handleError(n,e,t)))}catch(n){return this.handleError(n,e,t)}}_rpcRequestReplacement(t,e){const n={methodName:t,args:e};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const e=[];for(let n=0;n(t.map((t=>t.request)),this.requestChunk(t,1))))}),eN().batchInterval||10)),i}}const cN=()=>(null==tN()._Web3ClientProviders&&(tN()._Web3ClientProviders={}),tN()._Web3ClientProviders),lN=(t,e)=>{void 0===cN()[t]&&(cN()[t]=[]);const n=cN()[t].indexOf(e);n>-1&&cN()[t].splice(n,1),cN()[t].unshift(e)},hN=async(t,e,n=!0)=>{let r;cN()[t]=e.map(((r,i)=>new uN(r,t,e,(()=>{1===cN()[t].length?hN(t,e,n):cN()[t].splice(i,1)}))));let i=tN();if(null==i.fetch||void 0!==k&&k.env&&"test"==k.env.NODE_ENV||void 0!==i.cy||!1===n)r=cN()[t][0];else{let n=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();if(setTimeout((()=>e(900)),900),!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},referrer:"",referrerPolicy:"no-referrer",body:JSON.stringify({method:"getIdentity",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const i=Math.min(...n),o=n.indexOf(i);r=cN()[t][o]}lN(t,r)};var dN={getProvider:async t=>{let e=cN();if(e&&e[t])return e[t][0];let n=tN();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[t]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[t]=new Promise((async e=>{await hN(t,zf[t].endpoints),e(tN()._Web3ClientProviders[t][0])}))),await n._Web3ClientGetProviderPromise[t]},getProviders:async t=>{let e=cN();if(e&&e[t])return e[t];let n=tN();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[t]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[t]=new Promise((async e=>{await hN(t,zf[t].endpoints),e(tN()._Web3ClientProviders[t])}))),await n._Web3ClientGetProvidersPromise[t]},setProviderEndpoints:hN,setProvider:lN};let fN=["ethereum","bsc","polygon","solana","fantom","arbitrum","avalanche","gnosis","optimism","base"];fN.evm=["ethereum","bsc","polygon","fantom","arbitrum","avalanche","gnosis","optimism","base"],fN.solana=["solana"];let pN=()=>(null==tN()._Web3ClientCacheStore&&(tN()._Web3ClientCacheStore={}),tN()._Web3ClientCacheStore),yN=()=>(null==tN()._Web3ClientPromiseStore&&(tN()._Web3ClientPromiseStore={}),tN()._Web3ClientPromiseStore),mN=function({key:t}){yN()[t]=void 0},gN=function({call:t,key:e,expires:n=0}){return new Promise(((r,i)=>{let o,a=function({key:t}){return yN()[t]}({key:e=JSON.stringify(e)});if(a)return a.then(r).catch(i);(function({key:t,promise:e}){return yN()[t]=e,e})({key:e,promise:new Promise(((a,s)=>0===n?t().then((t=>{r(t),a(t)})).catch((t=>{i(t),s(t)})):(o=function({key:t,expires:e}){let n=pN()[t];if(function(t){let e,n=t[0],r=1;for(;rn.call(e,...t))),e=void 0)}return n}([n,"optionalAccess",t=>t.expiresAt])>Date.now())return n.value}({key:e,expires:n}),o?(r(o),a(o),o):void t().then((t=>{t&&function({key:t,value:e,expires:n}){pN()[t]={expiresAt:Date.now()+n,value:e}}({key:e,value:t,expires:n}),r(t),a(t)})).catch((t=>{i(t),s(t)})))))}).then((()=>{mN({key:e})})).catch((()=>{mN({key:e})}))}))};const vN=async t=>{if(fN.evm.includes(t))return await sN.getProvider(t);if(fN.solana.includes(t))return await dN.getProvider(t);throw"Unknown blockchain: "+t},wN=t=>`(${t.map((t=>"tuple"===t.type?wN(t.components):t.type)).join(",")})`;let bN=async function({blockchain:t,from:e,to:n,value:r,method:i,api:o,params:a,cache:s}){if(!fN.includes(t))throw"Unknown blockchain: "+t;void 0===r&&(r="0");const u=await vN(t);return await gN({expires:s||0,key:[t,e,n,r,i,a],call:async()=>(({provider:t,from:e,to:n,value:r,method:i,api:o,params:a})=>{if(void 0===o)return t.estimateGas({from:e,to:n,value:r});{let s=new kM(n,o,t),u=s.interface.fragments.find((t=>t.name==i)),c=(({contract:t,method:e,params:n})=>{let r=t.interface.fragments.find((t=>t.name==e));return n instanceof Array?n:n instanceof Object?r.inputs.map((t=>n[t.name])):void 0})({contract:s,method:i,params:a});void 0===s[i]&&(i=`${i}(${u.inputs.map((t=>"tuple"===t.type?wN(t.components):t.type)).join(",")})`);let l=s.estimateGas[i];return c?l(...c,{from:e,value:r}):l({from:e,value:r})}})({provider:u,from:e,to:n,value:r,method:i,api:o,params:a})})};const MN=({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a})=>n?(({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=new kM(t,e,i),s=(({contract:t,method:e,params:n})=>t.interface.fragments.find((t=>t.name==e)).inputs.map(((t,e)=>Array.isArray(n)?n[e]:n[t.name])))({contract:a,method:n,params:r}),u=a.interface.fragments.find((t=>t.name===n));return void 0===a[n]&&(n=`${n}(${u.inputs.map((t=>t.type)).join(",")})`),u&&"nonpayable"===u.stateMutability?a.callStatic[n](...s,{blockTag:o}):a[n](...s,{blockTag:o})})({address:e,api:n,method:r,params:i,provider:a,block:o}):"latestBlockNumber"===r?a.getBlockNumber():"balance"===r?(({address:t,provider:e})=>e.getBalance(t))({address:e,provider:a}):"transactionCount"===r?(({address:t,provider:e})=>e.getTransactionCount(t))({address:e,provider:a}):void 0,AN=async({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a,providers:s})=>{try{if(null==r||"getAccountInfo"===r)return null==n&&(n=Hd),await(async({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=await i.getAccountInfo(new Ws(t));if(a&&a.data)return e.decode(a.data)})({address:e,api:n,method:r,params:i,provider:a,block:o});if("getProgramAccounts"===r)return await a.getProgramAccounts(new Ws(e),i).then((t=>n?t.map((t=>(t.data=n.decode(t.account.data),t))):t));if("getTokenAccountBalance"===r)return await a.getTokenAccountBalance(new Ws(e));if("latestBlockNumber"===r)return await a.getSlot(i||void 0);if("balance"===r)return await(({address:t,provider:e})=>e.getBalance(new Ws(t)))({address:e,provider:a})}catch(u){if(s&&u&&["Failed to fetch","limit reached","504","503","502","500","429","426","422","413","409","408","406","405","404","403","402","401","400"].some((t=>u.toString().match(t)))){let u=s[s.indexOf(a)+1]||s[0];return AN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:u,providers:s})}throw u}},NN=async function(t,e){const{blockchain:n,address:r,method:i}=(t=>{if("object"==typeof t)return t;let e=t.match(/(?\w+):\/\/(?[\w\d]+)(\/(?[\w\d]+)*)?/);return null==e.groups.part2?e.groups.part1.match(/\d/)?{blockchain:e.groups.blockchain,address:e.groups.part1}:{blockchain:e.groups.blockchain,method:e.groups.part1}:{blockchain:e.groups.blockchain,address:e.groups.part1,method:e.groups.part2}})(t),{api:o,params:a,cache:s,block:u,timeout:c,strategy:l,cacheKey:h}=("object"==typeof t?t:e)||{};return await gN({expires:s||0,key:h||[n,r,i,a,u],call:async()=>{if(fN.evm.includes(n))return await(async({blockchain:t,address:e,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{if(s=s||eN().strategy||"failover",a=a||eN().timeout||void 0,"fastest"===s){const s=await sN.getProviders(t);let u=[];const c=s.map((a=>new Promise((s=>{u.push(MN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a}).then(s))})))),l=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a||1e4)));return u=Promise.all(u.map((t=>new Promise((e=>{t.catch(e)}))))).then((()=>{})),Promise.race([...c,l,u])}{const s=await sN.getProvider(t),u=MN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:s});return a?(a=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a))),Promise.race([u,a])):u}})({blockchain:n,address:r,api:o,method:i,params:a,block:u,strategy:l,timeout:c});if(fN.solana.includes(n))return await(async({blockchain:t,address:e,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{s=s||eN().strategy||"failover",a=a||eN().timeout||void 0;const u=await dN.getProviders(t);if("fastest"===s){let s=[];const c=u.map((a=>new Promise((u=>{s.push(AN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a}).then(u))})))),l=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a||1e4)));return s=Promise.all(s.map((t=>new Promise((e=>{t.catch(e)}))))).then((()=>{})),Promise.race([...c,l,s])}{const s=await dN.getProvider(t),c=AN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:s,providers:u});return a?(a=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a))),Promise.race([c,a])):c}})({blockchain:n,address:r,api:o,method:i,params:a,block:u,strategy:l,timeout:c});throw"Unknown blockchain: "+n}})};var IN=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.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 i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));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=128)}([function(t,e,n){(function(t,r,i){n.d(e,"a",(function(){return Ji})),n.d(e,"b",(function(){return ha})),n.d(e,"c",(function(){return $i})),n.d(e,"d",(function(){return To})),n.d(e,"e",(function(){return ot})),n.d(e,"f",(function(){return $})),n.d(e,"g",(function(){return Vi})),n.d(e,"h",(function(){return tt})),n.d(e,"i",(function(){return oo})),n.d(e,"j",(function(){return so})),n.d(e,"k",(function(){return no})),n.d(e,"l",(function(){return uo})),n.d(e,"m",(function(){return ao})),n.d(e,"n",(function(){return st})),n.d(e,"o",(function(){return rt})),n.d(e,"p",(function(){return Ui})),n.d(e,"q",(function(){return Z})),n.d(e,"r",(function(){return nt})),n.d(e,"s",(function(){return xo})),n.d(e,"t",(function(){return to})),n.d(e,"u",(function(){return eo})),n.d(e,"v",(function(){return G})),n.d(e,"w",(function(){return H})),n.d(e,"x",(function(){return qi})),n.d(e,"y",(function(){return lt})),n.d(e,"z",(function(){return Bi})),n.d(e,"A",(function(){return jo})),n.d(e,"B",(function(){return Gi})),n.d(e,"C",(function(){return _i})),n.d(e,"D",(function(){return Zi})),n.d(e,"E",(function(){return po})),n.d(e,"F",(function(){return fo})),n.d(e,"G",(function(){return Co})),n.d(e,"H",(function(){return ct})),n.d(e,"I",(function(){return ro})),n.d(e,"J",(function(){return io})),n.d(e,"K",(function(){return F})),n.d(e,"L",(function(){return oa})),n.d(e,"M",(function(){return at})),n.d(e,"N",(function(){return Y})),n.d(e,"O",(function(){return ua})),n.d(e,"P",(function(){return Qo})),n.d(e,"Q",(function(){return W})),n.d(e,"R",(function(){return Bo})),n.d(e,"S",(function(){return Yo})),n.d(e,"T",(function(){return ho})),n.d(e,"U",(function(){return zo})),n.d(e,"V",(function(){return Do})),n.d(e,"W",(function(){return Wo})),n.d(e,"X",(function(){return Ko})),n.d(e,"Y",(function(){return ea})),n.d(e,"Z",(function(){return Jo})),n.d(e,"ab",(function(){return Go})),n.d(e,"bb",(function(){return na})),n.d(e,"cb",(function(){return ia})),n.d(e,"db",(function(){return ra})),n.d(e,"eb",(function(){return Oo})),n.d(e,"fb",(function(){return Xo})),n.d(e,"gb",(function(){return qo})),n.d(e,"hb",(function(){return Zo})),n.d(e,"ib",(function(){return $o})),n.d(e,"jb",(function(){return sa})),n.d(e,"kb",(function(){return Ho})),n.d(e,"lb",(function(){return ta})),n.d(e,"mb",(function(){return Po})),n.d(e,"nb",(function(){return Uo})),n.d(e,"ob",(function(){return X})),n.d(e,"pb",(function(){return Hi})),n.d(e,"qb",(function(){return K})),n.d(e,"rb",(function(){return S})),n.d(e,"sb",(function(){return it})),n.d(e,"tb",(function(){return Io})),n.d(e,"ub",(function(){return ca})),n.d(e,"vb",(function(){return co})),n.d(e,"wb",(function(){return lo})),n.d(e,"xb",(function(){return Ri}));var o=n(71),a=n(1),s=n(21),u=n(68),c=n(32),l=n(43),h=n(69),d=n(24),f=n(38),p=n(44),y=n(5),m=n(70);function g(t,e,n){return(e=M(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){for(var n=0;n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function N(t){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function I(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=k(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function E(t){return function(t){if(Array.isArray(t))return T(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||k(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(t,e)||k(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(t,e){if(t){if("string"==typeof t)return T(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T(t,e):void 0}}function T(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:a.FIVE_MINUTES,i=arguments.length>1?arguments[1]:void 0,o=Object(a.toMiliseconds)(r||a.FIVE_MINUTES);return{resolve:function(e){n&&t&&(clearTimeout(n),t(e))},reject:function(t){n&&e&&(clearTimeout(n),e(t))},done:function(){return new Promise((function(r,a){n=setTimeout((function(){a(new Error(i))}),o),t=r,e=a}))}}}function tt(t,e,n){var r=this;return new Promise((function(i,o){return L(r,null,A().mark((function r(){var a,s;return A().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=setTimeout((function(){return o(new Error(n))}),e),r.prev=1,r.next=4,t;case 4:s=r.sent,i(s),r.next=11;break;case 8:r.prev=8,r.t0=r.catch(1),o(r.t0);case 11:clearTimeout(a);case 12:case"end":return r.stop()}}),r,null,[[1,8]])})))}))}function et(t,e){if("string"==typeof e&&e.startsWith("".concat(t,":")))return e;if("topic"===t.toLowerCase()){if("string"!=typeof e)throw new Error('Value must be "string" for expirer target type: topic');return"topic:".concat(e)}if("id"===t.toLowerCase()){if("number"!=typeof e)throw new Error('Value must be "number" for expirer target type: id');return"id:".concat(e)}throw new Error("Unknown expirer target type: ".concat(t))}function nt(t){return et("topic",t)}function rt(t){return et("id",t)}function it(t){var e=x(t.split(":"),2),n=e[0],r=e[1],i={id:void 0,topic:void 0};if("topic"===n&&"string"==typeof r)i.topic=r;else{if("id"!==n||!Number.isInteger(Number(r)))throw new Error("Invalid target, expected id:number or topic:string, got ".concat(n,":").concat(r));i.id=Number(r)}return i}function ot(t,e){return Object(a.fromMiliseconds)((e||Date.now())+Object(a.toMiliseconds)(t))}function at(t){return Date.now()>=Object(a.toMiliseconds)(t)}function st(t,e){return"".concat(t).concat(e?":".concat(e):"")}function ut(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return E(new Set([].concat(E(t),E(e))))}function ct(t){return L(this,arguments,(function(t){var e=t.id,n=t.topic,i=t.wcDeepLink;return A().mark((function t(){var o,a,s,u;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,i){t.next=3;break}return t.abrupt("return");case 3:if(o="string"==typeof i?JSON.parse(i):i,"string"==typeof(a=null==o?void 0:o.href)){t.next=7;break}return t.abrupt("return");case 7:if(a.endsWith("/")&&(a=a.slice(0,-1)),s="".concat(a,"/wc?requestId=").concat(e,"&sessionTopic=").concat(n),(u=V())!==U){t.next=13;break}s.startsWith("https://")||s.startsWith("http://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"),t.next=17;break;case 13:if(t.t0=u===B&&N(null==r?void 0:r.Linking)<"u",!t.t0){t.next=17;break}return t.next=17,r.Linking.openURL(s);case 17:t.next=22;break;case 19:t.prev=19,t.t1=t.catch(0),console.error(t.t1);case 22:case"end":return t.stop()}}),t,null,[[0,19]])}))()}))}function lt(t,e){return L(this,null,A().mark((function n(){return A().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,t.getItem(e);case 3:if(n.t0=n.sent,n.t0){n.next=6;break}n.t0=F()?localStorage.getItem(e):void 0;case 6:return n.abrupt("return",n.t0);case 9:n.prev=9,n.t1=n.catch(0),console.error(n.t1);case 12:case"end":return n.stop()}}),n,null,[[0,9]])})))}var ht=("undefined"==typeof globalThis?"undefined":N(globalThis))<"u"?globalThis:("undefined"==typeof window?"undefined":N(window))<"u"?window:(void 0===r?"undefined":N(r))<"u"?r:("undefined"==typeof self?"undefined":N(self))<"u"?self:{},dt={exports:{}};!function(e){!function(){var n="input is invalid type",r="object"==("undefined"==typeof window?"undefined":N(window)),i=r?window:{};i.JS_SHA3_NO_WINDOW&&(r=!1);var o=!r&&"object"==("undefined"==typeof self?"undefined":N(self));!i.JS_SHA3_NO_NODE_JS&&"object"==(void 0===t?"undefined":N(t))&&t.versions&&t.versions.node?i=ht:o&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&e.exports,s=!i.JS_SHA3_NO_ARRAY_BUFFER&&("undefined"==typeof ArrayBuffer?"undefined":N(ArrayBuffer))<"u",u="0123456789abcdef".split(""),c=[4,1024,262144,67108864],l=[0,8,16,24],h=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],f=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],y={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),s&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return"object"==N(t)&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var m=function(t,e,n){return function(r){return new C(t,e,t).update(r)[n]()}},g=function(t,e,n){return function(r,i){return new C(t,e,i).update(r)[n]()}},v=function(t,e,n){return function(e,r,i,o){return I["cshake"+t].update(e,r,i,o)[n]()}},w=function(t,e,n){return function(e,r,i,o){return I["kmac"+t].update(e,r,i,o)[n]()}},b=function(t,e,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function D(t,e,n){C.call(this,t,e,n)}C.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=N(t);if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(s&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||s&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var i,o,a=this.blocks,u=this.byteCount,c=t.length,h=this.blockCount,d=0,f=this.s;d>2]|=t[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(a[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=u){for(this.start=i-u,this.block=a[h],i=0;i>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},C.prototype.encodeString=function(t){var e,r=N(t);if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(s&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||s&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}var i=0,o=t.length;if(e)i=o;else for(var a=0;a=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(t),i},C.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e>4&15]+u[15&t]+u[t>>12&15]+u[t>>8&15]+u[t>>20&15]+u[t>>16&15]+u[t>>28&15]+u[t>>24&15];a%e==0&&(O(n),o=0)}return i&&(t=n[o],s+=u[t>>4&15]+u[15&t],i>1&&(s+=u[t>>12&15]+u[t>>8&15]),i>2&&(s+=u[t>>20&15]+u[t>>16&15])),s},C.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&O(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},D.prototype=new C,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var O=function(t){var e,n,r,i,o,a,s,u,c,l,d,f,p,y,m,g,v,w,b,M,A,N,I,E,x,k,T,L,S,j,C,D,O,z,P,_,B,R,U,Q,Y,W,F,V,H,G,q,Z,J,X,K,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(l<<1|d>>>31),n=s^(d<<1|l>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=l^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,y=t[0],m=t[1],G=t[11]<<4|t[10]>>>28,q=t[10]<<4|t[11]>>>28,L=t[20]<<3|t[21]>>>29,S=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,W=t[40]<<18|t[41]>>>14,F=t[41]<<18|t[40]>>>14,z=t[2]<<1|t[3]>>>31,P=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,Z=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,j=t[33]<<13|t[32]>>>19,C=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,_=t[14]<<6|t[15]>>>26,B=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,K=t[35]<<15|t[34]>>>17,D=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,E=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,R=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,H=t[9]<<27|t[8]>>>5,k=t[18]<<20|t[19]>>>12,T=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,Q=t[38]<<8|t[39]>>>24,Y=t[39]<<8|t[38]>>>24,N=t[48]<<14|t[49]>>>18,I=t[49]<<14|t[48]>>>18,t[0]=y^~g&w,t[1]=m^~v&b,t[10]=E^~k&L,t[11]=x^~T&S,t[20]=z^~_&R,t[21]=P^~B&U,t[30]=V^~G&Z,t[31]=H^~q&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=g^~w&M,t[3]=v^~b&A,t[12]=k^~L&j,t[13]=T^~S&C,t[22]=_^~R&Q,t[23]=B^~U&Y,t[32]=G^~Z&X,t[33]=q^~J&K,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=w^~M&N,t[5]=b^~A&I,t[14]=L^~j&D,t[15]=S^~C&O,t[24]=R^~Q&W,t[25]=U^~Y&F,t[34]=Z^~X&$,t[35]=J^~K&tt,t[44]=ot^~st&ct,t[45]=at^~ut<,t[6]=M^~N&y,t[7]=A^~I&m,t[16]=j^~D&E,t[17]=C^~O&x,t[26]=Q^~W&z,t[27]=Y^~F&P,t[36]=X^~$&V,t[37]=K^~tt&H,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=N^~y&g,t[9]=I^~m&v,t[18]=D^~E&k,t[19]=O^~x&T,t[28]=W^~z&_,t[29]=F^~P&B,t[38]=$^~V&G,t[39]=tt^~H&q,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=h[r],t[1]^=h[r+1]};if(a)e.exports=I;else for(x=0;xvt[n])&&console.log.apply(console,e)}},{key:"debug",value:function(){for(var e=arguments.length,n=new Array(e),r=0;r>4],n+=At[15&e[o]];i.push(t+"=Uint8Array(0x"+n+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push("code=".concat(n)),i.push("version=".concat(this.version));var o=e,a="";switch(n){case pt.NUMERIC_FAULT:a="NUMERIC_FAULT";var s=e;switch(s){case"overflow":case"underflow":case"division-by-zero":a+="-"+s;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result"}break;case pt.CALL_EXCEPTION:case pt.INSUFFICIENT_FUNDS:case pt.MISSING_NEW:case pt.NONCE_EXPIRED:case pt.REPLACEMENT_UNDERPRICED:case pt.TRANSACTION_REPLACED:case pt.UNPREDICTABLE_GAS_LIMIT:a=n}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),i.length&&(e+=" ("+i.join(", ")+")");var u=new Error(e);return u.reason=o,u.code=n,Object.keys(r).forEach((function(t){u[t]=r[t]})),u}},{key:"throwError",value:function(t,e,n){throw this.makeError(t,e,n)}},{key:"throwArgumentError",value:function(e,n,r){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:n,value:r})}},{key:"assert",value:function(t,e,n,r){t||this.throwError(e,n,r)}},{key:"assertArgument",value:function(t,e,n,r){t||this.throwArgumentError(e,n,r)}},{key:"checkNormalize",value:function(e){Mt&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Mt})}},{key:"checkSafeUint53",value:function(e,n){"number"==typeof e&&(null==n&&(n="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(n,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(n,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}},{key:"checkArgumentCount",value:function(e,n,r){r=r?": "+r:"",en&&this.throwError("too many arguments"+r,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:n})}},{key:"checkNew",value:function(e,n){(e===Object||null==e)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:n.name})}},{key:"checkAbstract",value:function(e,n){e===n?this.throwError("cannot instantiate abstract class "+JSON.stringify(n.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||null==e)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:n.name})}}],[{key:"globalLogger",value:function(){return bt||(bt=new t("logger/5.7.0")),bt}},{key:"setCensorship",value:function(e,n){if(!e&&n&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),mt){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}gt=!!e,mt=!!n}},{key:"setLogLevel",value:function(e){var n=vt[e.toLowerCase()];null!=n?wt=n:t.globalLogger().warn("invalid log level - "+e)}},{key:"from",value:function(e){return new t(e)}}])}();Nt.errors=pt,Nt.levels=ft;var It=new Nt("bytes/5.7.0");function Et(t){return!!t.toHexString}function xt(t){return t.slice||(t.slice=function(){var e=Array.prototype.slice.call(arguments);return xt(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function kt(t){return"number"==typeof t&&t==t&&t%1==0}function Tt(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t||!kt(t.length)||t.length<0)return!1;for(var e=0;e=256)return!1}return!0}function Lt(t,e){if(e||(e={}),"number"==typeof t){It.checkSafeUint53(t,"invalid arrayify value");for(var n=[];t;)n.unshift(255&t),t=parseInt(String(t/256));return 0===n.length&&n.push(0),xt(new Uint8Array(n))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Et(t)&&(t=t.toHexString()),St(t)){var r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":It.throwArgumentError("hex data is odd-length","value",t));for(var i=[],o=0;o>4]+jt[15&o]}return r}return It.throwArgumentError("invalid hexlify value","value",t)}function Dt(t,e,n){return"string"!=typeof t?t=Ct(t):(!St(t)||t.length%2)&&It.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=n?"0x"+t.substring(e,2+2*n):"0x"+t.substring(e)}function Ot(t,e){for("string"!=typeof t?t=Ct(t):St(t)||It.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&It.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function zt(t){var e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(function(t){return St(t)&&!(t.length%2)||Tt(t)}(t)){var n=Lt(t);64===n.length?(e.v=27+(n[32]>>7),n[32]&=127,e.r=Ct(n.slice(0,32)),e.s=Ct(n.slice(32,64))):65===n.length?(e.r=Ct(n.slice(0,32)),e.s=Ct(n.slice(32,64)),e.v=n[64]):It.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:It.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(n[32]|=128),e._vs=Ct(n.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){var r=function(t,e){(t=Lt(t)).length>e&&It.throwArgumentError("value out of range","value",arguments[0]);var n=new Uint8Array(e);return n.set(t,e-t.length),xt(n)}(Lt(e._vs),32);e._vs=Ct(r);var i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&It.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;var o=Ct(r);null==e.s?e.s=o:e.s!==o&&It.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?It.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{var a=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==a&&It.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&St(e.r)?e.r=Ot(e.r,32):It.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&St(e.s)?e.s=Ot(e.s,32):It.throwArgumentError("signature missing or invalid s","signature",t);var s=Lt(e.s);s[0]>=128&&It.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(s[0]|=128);var u=Ct(s);e._vs&&(St(e._vs)||It.throwArgumentError("signature invalid _vs","signature",t),e._vs=Ot(e._vs,32)),null==e._vs?e._vs=u:e._vs!==u&&It.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Pt(t){return"0x"+yt.keccak_256(Lt(t))}var _t={exports:{}},Bt=function(t){var e=t.default;if("function"==typeof e){var n=function(){return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}(Object.freeze({__proto__:null,default:{}}));!function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"==N(t)?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o=("undefined"==typeof window?"undefined":N(window))<"u"&&N(window.Buffer)<"u"?window.Buffer:Bt.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==N(t))return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},("undefined"==typeof Symbol?"undefined":N(Symbol))<"u"&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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 p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}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 r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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 8191&e||(n+=13,e>>>=13),127&e||(n+=7,e>>>=7),15&e||(n+=4,e>>>=4),3&e||(n+=2,e>>>=2),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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&a}for(;i>26,this.words[i+r]=67108863&a;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):this.negative&t.negative?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;!(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;!(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e,r=this,o=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var a=new i(1),s=new i(0),u=o.clone();r.cmpn(1)>0&&o.cmpn(1)>0;){for(var c=0,l=1;!(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;!(o.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(o.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);r.cmp(o)>=0?(r.isub(o),a.isub(s)):(o.isub(r),s.isub(a))}return(e=0===r.cmpn(1)?a:s).cmpn(0)<0&&e.iadd(t),e},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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 E(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function x(t){E.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new I}return v[t]=e,e},E.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.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)},E.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},E.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)},E.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new x(t)},r(x,E),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,ht)}(_t);var Rt=_t.exports,Ut="bignumber/5.7.0",Qt=Rt.BN,Yt=new Nt(Ut),Wt={},Ft=9007199254740991,Vt=!1,Ht=function(){function t(e,n){v(this,t),e!==Wt&&Yt.throwError("cannot call constructor directly; use BigNumber.from",Nt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=n,this._isBigNumber=!0,Object.freeze(this)}return b(t,[{key:"fromTwos",value:function(t){return qt(Zt(this).fromTwos(t))}},{key:"toTwos",value:function(t){return qt(Zt(this).toTwos(t))}},{key:"abs",value:function(){return"-"===this._hex[0]?t.from(this._hex.substring(1)):this}},{key:"add",value:function(t){return qt(Zt(this).add(Zt(t)))}},{key:"sub",value:function(t){return qt(Zt(this).sub(Zt(t)))}},{key:"div",value:function(e){return t.from(e).isZero()&&Jt("division-by-zero","div"),qt(Zt(this).div(Zt(e)))}},{key:"mul",value:function(t){return qt(Zt(this).mul(Zt(t)))}},{key:"mod",value:function(t){var e=Zt(t);return e.isNeg()&&Jt("division-by-zero","mod"),qt(Zt(this).umod(e))}},{key:"pow",value:function(t){var e=Zt(t);return e.isNeg()&&Jt("negative-power","pow"),qt(Zt(this).pow(e))}},{key:"and",value:function(t){var e=Zt(t);return(this.isNegative()||e.isNeg())&&Jt("unbound-bitwise-result","and"),qt(Zt(this).and(e))}},{key:"or",value:function(t){var e=Zt(t);return(this.isNegative()||e.isNeg())&&Jt("unbound-bitwise-result","or"),qt(Zt(this).or(e))}},{key:"xor",value:function(t){var e=Zt(t);return(this.isNegative()||e.isNeg())&&Jt("unbound-bitwise-result","xor"),qt(Zt(this).xor(e))}},{key:"mask",value:function(t){return(this.isNegative()||t<0)&&Jt("negative-width","mask"),qt(Zt(this).maskn(t))}},{key:"shl",value:function(t){return(this.isNegative()||t<0)&&Jt("negative-width","shl"),qt(Zt(this).shln(t))}},{key:"shr",value:function(t){return(this.isNegative()||t<0)&&Jt("negative-width","shr"),qt(Zt(this).shrn(t))}},{key:"eq",value:function(t){return Zt(this).eq(Zt(t))}},{key:"lt",value:function(t){return Zt(this).lt(Zt(t))}},{key:"lte",value:function(t){return Zt(this).lte(Zt(t))}},{key:"gt",value:function(t){return Zt(this).gt(Zt(t))}},{key:"gte",value:function(t){return Zt(this).gte(Zt(t))}},{key:"isNegative",value:function(){return"-"===this._hex[0]}},{key:"isZero",value:function(){return Zt(this).isZero()}},{key:"toNumber",value:function(){try{return Zt(this).toNumber()}catch(t){Jt("overflow","toNumber",this.toString())}return null}},{key:"toBigInt",value:function(){try{return BigInt(this.toString())}catch(t){}return Yt.throwError("this platform does not support BigInt",Nt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}},{key:"toString",value:function(){return arguments.length>0&&(10===arguments[0]?Vt||(Vt=!0,Yt.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Yt.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Nt.errors.UNEXPECTED_ARGUMENT,{}):Yt.throwError("BigNumber.toString does not accept parameters",Nt.errors.UNEXPECTED_ARGUMENT,{})),Zt(this).toString(10)}},{key:"toHexString",value:function(){return this._hex}},{key:"toJSON",value:function(t){return{type:"BigNumber",hex:this.toHexString()}}}],[{key:"from",value:function(e){if(e instanceof t)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new t(Wt,Gt(e)):e.match(/^-?[0-9]+$/)?new t(Wt,Gt(new Qt(e))):Yt.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Jt("underflow","BigNumber.from",e),(e>=Ft||e<=-Ft)&&Jt("overflow","BigNumber.from",e),t.from(String(e));var n=e;if("bigint"==typeof n)return t.from(n.toString());if(Tt(n))return t.from(Ct(n));if(n)if(n.toHexString){var r=n.toHexString();if("string"==typeof r)return t.from(r)}else{var i=n._hex;if(null==i&&"BigNumber"===n.type&&(i=n.hex),"string"==typeof i&&(St(i)||"-"===i[0]&&St(i.substring(1))))return t.from(i)}return Yt.throwArgumentError("invalid BigNumber value","value",e)}},{key:"isBigNumber",value:function(t){return!(!t||!t._isBigNumber)}}])}();function Gt(t){if("string"!=typeof t)return Gt(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Yt.throwArgumentError("invalid hex","value",t),"0x00"===(t=Gt(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function qt(t){return Ht.from(Gt(t))}function Zt(t){var e=Ht.from(t).toHexString();return"-"===e[0]?new Qt("-"+e.substring(3),16):new Qt(e.substring(2),16)}function Jt(t,e,n){var r={fault:t,operation:e};return null!=n&&(r.value=n),Yt.throwError(t,Nt.errors.NUMERIC_FAULT,r)}var Xt=new Nt(Ut),Kt={},$t=Ht.from(0),te=Ht.from(-1);function ee(t,e,n,r){var i={fault:e,operation:n};return void 0!==r&&(i.value=r),Xt.throwError(t,Nt.errors.NUMERIC_FAULT,i)}for(var ne="0";ne.length<256;)ne+=ne;function re(t){if("number"!=typeof t)try{t=Ht.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+ne.substring(0,t):Xt.throwArgumentError("invalid decimal size","decimals",t)}function ie(t,e){null==e&&(e=0);var n=re(e),r=(t=Ht.from(t)).lt($t);r&&(t=t.mul(te));for(var i=t.mod(n).toString();i.length2&&Xt.throwArgumentError("too many decimal points","value",t);var o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>n.length-1&&ee("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length80&&Xt.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new t(Kt,n,r,i)}}])}(),ce=function(){function t(e,n,r,i){v(this,t),e!==Kt&&Xt.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Nt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=n,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}return b(t,[{key:"_checkFormat",value:function(t){this.format.name!==t.format.name&&Xt.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}},{key:"addUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.add(r),this.format.decimals,this.format)}},{key:"subUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.sub(r),this.format.decimals,this.format)}},{key:"mulUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}},{key:"divUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}},{key:"floor",value:function(){var e=this.toString().split(".");1===e.length&&e.push("0");var n=t.from(e[0],this.format),r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(n=n.subUnsafe(le.toFormat(n.format))),n}},{key:"ceiling",value:function(){var e=this.toString().split(".");1===e.length&&e.push("0");var n=t.from(e[0],this.format),r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(n=n.addUnsafe(le.toFormat(n.format))),n}},{key:"round",value:function(e){null==e&&(e=0);var n=this.toString().split(".");if(1===n.length&&n.push("0"),(e<0||e>80||e%1)&&Xt.throwArgumentError("invalid decimal count","decimals",e),n[1].length<=e)return this;var r=t.from("1"+ne.substring(0,e),this.format),i=he.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(i).floor().divUnsafe(r)}},{key:"isZero",value:function(){return"0.0"===this._value||"0"===this._value}},{key:"isNegative",value:function(){return"-"===this._value[0]}},{key:"toString",value:function(){return this._value}},{key:"toHexString",value:function(t){return null==t?this._hex:(t%8&&Xt.throwArgumentError("invalid byte width","width",t),Ot(Ht.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8))}},{key:"toUnsafeFloat",value:function(){return parseFloat(this.toString())}},{key:"toFormat",value:function(e){return t.fromString(this._value,e)}}],[{key:"fromValue",value:function(e,n,r){return null==r&&null!=n&&!function(t){return null!=t&&(Ht.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||St(t)||"bigint"==typeof t||Tt(t))}(n)&&(r=n,n=null),null==n&&(n=0),null==r&&(r="fixed"),t.fromString(ie(e,n),ue.from(r))}},{key:"fromString",value:function(e,n){null==n&&(n="fixed");var r=ue.from(n),i=oe(e,r.decimals);!r.signed&&i.lt($t)&&ee("unsigned value cannot be negative","overflow","value",e);var o=null;o=r.signed?i.toTwos(r.width).toHexString():Ot(o=i.toHexString(),r.width/8);var a=ie(i,r.decimals);return new t(Kt,o,a,r)}},{key:"fromBytes",value:function(e,n){null==n&&(n="fixed");var r=ue.from(n);if(Lt(e).length>r.width/8)throw new Error("overflow");var i=Ht.from(e);r.signed&&(i=i.fromTwos(r.width));var o=i.toTwos((r.signed?0:1)+r.width).toHexString(),a=ie(i,r.decimals);return new t(Kt,o,a,r)}},{key:"from",value:function(e,n){if("string"==typeof e)return t.fromString(e,n);if(Tt(e))return t.fromBytes(e,n);try{return t.fromValue(e,0,n)}catch(t){if(t.code!==Nt.errors.INVALID_ARGUMENT)throw t}return Xt.throwArgumentError("invalid FixedNumber value","value",e)}},{key:"isFixedNumber",value:function(t){return!(!t||!t._isFixedNumber)}}])}(),le=ce.from(1),he=ce.from("0.5"),de=new Nt("strings/5.7.0");function fe(t,e,n,r,i){if(t===se.BAD_PREFIX||t===se.UNEXPECTED_CONTINUE){for(var o=0,a=e+1;a>6==2;a++)o++;return o}return t===se.OVERRUN?n.length-e-1:0}function pe(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ae.current;e!=ae.current&&(de.checkNormalize(),t=t.normalize(e));for(var n=[],r=0;r>6|192),n.push(63&i|128);else if(55296==(64512&i)){r++;var o=t.charCodeAt(r);if(r>=t.length||56320!=(64512&o))throw new Error("invalid utf-8 string");var a=65536+((1023&i)<<10)+(1023&o);n.push(a>>18|240),n.push(a>>12&63|128),n.push(a>>6&63|128),n.push(63&a|128)}else n.push(i>>12|224),n.push(i>>6&63|128),n.push(63&i|128)}return Lt(n)}function ye(t,e){e||(e=function(t){return[parseInt(t,16)]});var n=0,r={};return t.split(",").forEach((function(t){var i=t.split(":");n+=parseInt(i[0],16),r[n]=e(i[1])})),r}function me(t){var e=0;return t.split(",").map((function(t){var n=t.split("-");return 1===n.length?n[1]="0":""===n[1]&&(n[1]="1"),{l:e+parseInt(n[0],16),h:e=parseInt(n[1],16)}}))}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(ae||(ae={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(se||(se={})),Object.freeze({error:function(t,e,n,r,i){return de.throwArgumentError("invalid codepoint at offset ".concat(e,"; ").concat(t),"bytes",n)},ignore:fe,replace:function(t,e,n,r,i){return t===se.OVERLONG?(r.push(i),0):(r.push(65533),fe(t,e,n))}}),me("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((function(t){return parseInt(t,16)})),ye("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),ye("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),ye("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");for(var e=[],n=0;n0&&Array.isArray(e)?t(e,i-1):n.push(e)}))}(t,e),n}function we(t){return 1&t?~t>>1:t>>1}function be(t,e){for(var n=Array(t),r=0,i=-1;r>--c&1}for(var d=Math.pow(2,31),f=d>>>1,p=f>>1,y=d-1,m=0,g=0;g<31;g++)m=m<<1|h();for(var v=[],w=0,b=d;;){for(var M=Math.floor(((m-w+1)*i-1)/b),A=0,N=r;N-A>1;){var I=A+N>>>1;M>>1|h(),E=E<<1^f,x=(x^f)<<1|f|1;w=E,b=1+x-E}var k=r-4;return v.map((function(e){switch(e-k){case 3:return k+65792+(t[u++]<<16|t[u++]<<8|t[u++]);case 2:return k+256+(t[u++]<<8|t[u++]);case 1:return k+t[u++];default:return e-1}}))}(t))}(function(t){t=atob(t);for(var e=[],n=0;n>=1),check:2==o}}()}(xe),new Nt(ge),new Uint8Array(32).fill(0),new Nt("rlp/5.7.0");var Te=new Nt("address/5.7.0");function Le(t){St(t,20)||Te.throwArgumentError("invalid address","address",t);for(var e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40),r=0;r<40;r++)n[r]=e[r].charCodeAt(0);for(var i=Lt(Pt(n)),o=0;o<40;o+=2)i[o>>1]>>4>=8&&(e[o]=e[o].toUpperCase()),(15&i[o>>1])>=8&&(e[o+1]=e[o+1].toUpperCase());return"0x"+e.join("")}for(var Se={},je=0;je<10;je++)Se[String(je)]=String(je);for(var Ce=0;Ce<26;Ce++)Se[String.fromCharCode(65+Ce)]=String(10+Ce);var De=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Oe(t,e,n){Object.defineProperty(t,e,{enumerable:!0,value:n,writable:!1})}new Nt("properties/5.7.0"),new Nt(ge),new Uint8Array(32).fill(0),Ht.from(-1);var ze=Ht.from(0),Pe=Ht.from(1);Ht.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Ot(Pe.toHexString(),32),Ot(ze.toHexString(),32);var _e={},Be={},Re=Ue;function Ue(t,e){if(!t)throw new Error(e||"Assertion failed")}Ue.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var Qe={exports:{}};"function"==typeof Object.create?Qe.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Qe.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}};var Ye=Re,We=Qe.exports;function Fe(t,e){return!(55296!=(64512&t.charCodeAt(e))||e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function Ve(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function He(t){return 1===t.length?"0"+t:t}function Ge(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}Be.inherits=We,Be.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,n[r++]=63&o|128):Fe(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i>>0}return o},Be.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},Be.rotr32=function(t,e){return t>>>e|t<<32-e},Be.rotl32=function(t,e){return t<>>32-e},Be.sum32=function(t,e){return t+e>>>0},Be.sum32_3=function(t,e,n){return t+e+n>>>0},Be.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},Be.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},Be.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o>>0,t[e+1]=o},Be.sum64_hi=function(t,e,n,r){return(e+r>>>0>>0},Be.sum64_lo=function(t,e,n,r){return e+r>>>0},Be.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)>>0)>>0)>>0},Be.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},Be.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)>>0)>>0)>>0)>>0},Be.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},Be.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},Be.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},Be.shr64_hi=function(t,e,n){return t>>>n},Be.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var qe={},Ze=Be,Je=Re;function Xe(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}qe.BlockHash=Xe,Xe.prototype.update=function(t,e){if(t=Ze.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=Ze.join32(t,0,t.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},$e.g1_256=function(t){return tn(t,17)^tn(t,19)^t>>>10};var on=Be,an=qe,sn=$e,un=on.rotl32,cn=on.sum32,ln=on.sum32_5,hn=sn.ft_1,dn=an.BlockHash,fn=[1518500249,1859775393,2400959708,3395469782];function pn(){if(!(this instanceof pn))return new pn;dn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}on.inherits(pn,dn);var yn=pn;pn.blockSize=512,pn.outSize=160,pn.hmacStrength=80,pn.padLength=64,pn.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;rthis.blockSize&&(t=(new this.Hash).update(t).digest()),Or(t.length<=this.blockSize);for(var e=t.length;e>8,a=255&i;o?n.push(o,a):n.push(a)}return n},n.zero2=r,n.toHex=i,n.encode=function(t,e){return"hex"===e?i(t):t}})),Qr=_r((function(t,e){var n=e;n.assert=Br,n.toArray=Ur.toArray,n.zero2=Ur.zero2,n.toHex=Ur.toHex,n.encode=Ur.encode,n.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},n.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=1&u?3!=(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u:0,n[0].push(a),s=1&c?3!=(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c:0,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},n.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new Rt(t,"hex","le")}})),Yr=Qr.getNAF,Wr=Qr.getJSF,Fr=Qr.assert;function Vr(t,e){this.type=t,this.p=new Rt(e.p,16),this.red=e.prime?Rt.red(e.prime):Rt.mont(this.p),this.zero=new Rt(0).toRed(this.red),this.one=new Rt(1).toRed(this.red),this.two=new Rt(2).toRed(this.red),this.n=e.n&&new Rt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hr=Vr;function Gr(t,e){this.curve=t,this.type=e,this.precomputed=null}Vr.prototype.point=function(){throw new Error("Not implemented")},Vr.prototype.validate=function(){throw new Error("Not implemented")},Vr.prototype._fixedNafMul=function(t,e){Fr(t.precomputed);var n=t._getDoubles(),r=Yr(e,1,this._bitLength),i=(1<=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];Fr(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},Vr.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var y=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(y[1]=e[f].add(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].add(e[p].neg())):(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=Wr(n[f],n[p]);for(h=Math.max(g[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a=0;o--){for(var A=0;o>=0;){var N=!0;for(a=0;a=0&&A++,b=b.dblp(A),o<0)break;for(a=0;a0?s=c[a][I-1>>1]:I<0&&(s=c[a][-I-1>>1].neg()),b="affine"===s.type?b.mixedAdd(s):b.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},Gr.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},Jr.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},Jr.prototype.pointFromX=function(t,e){(t=new Rt(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},Jr.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Jr.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},Kr.prototype.isInfinity=function(){return this.inf},Kr.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},Kr.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Kr.prototype.getX=function(){return this.x.fromRed()},Kr.prototype.getY=function(){return this.y.fromRed()},Kr.prototype.mul=function(t){return t=new Rt(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Kr.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},Kr.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},Kr.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Kr.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},Kr.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},qr($r,Hr.BasePoint),Jr.prototype.jpoint=function(t,e,n){return new $r(this,t,e,n)},$r.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},$r.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$r.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},$r.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},$r.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},$r.prototype.inspect=function(){return this.isInfinity()?"":""},$r.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var ti=_r((function(t,e){var n=e;n.base=Hr,n.short=Xr,n.mont=null,n.edwards=null})),ei=_r((function(t,e){var n,r=e,i=Qr.assert;function o(t){"short"===t.type?this.curve=new ti.short(t):"edwards"===t.type?this.curve=new ti.edwards(t):this.curve=new ti.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new o(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:_e.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:_e.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:_e.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:_e.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:_e.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_e.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_e.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(t){n=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:_e.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function ni(t){if(!(this instanceof ni))return new ni(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Ur.toArray(t.entropy,t.entropyEnc||"hex"),n=Ur.toArray(t.nonce,t.nonceEnc||"hex"),r=Ur.toArray(t.pers,t.persEnc||"hex");Br(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var ri=ni;ni.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},ni.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=Ur.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var si=Qr.assert;function ui(t,e){if(t instanceof ui)return t;this._importDER(t,e)||(si(t.r&&t.s,"Signature without r or s"),this.r=new Rt(t.r,16),this.s=new Rt(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var ci=ui;function li(){this.place=0}function hi(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o>>=0;return!(i<=127)&&(e.place=a,i)}function di(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}ui.prototype._importDER=function(t,e){t=Qr.toArray(t,e);var n=new li;if(48!==t[n.place++])return!1;var r=hi(t,n);if(!1===r||r+n.place!==t.length||2!==t[n.place++])return!1;var i=hi(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=hi(t,n);if(!1===a||t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new Rt(o),this.s=new Rt(s),this.recoveryParam=null,!0},ui.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=di(e),n=di(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];fi(r,e.length),(r=r.concat(e)).push(2),fi(r,n.length);var i=r.concat(n),o=[48];return fi(o,i.length),o=o.concat(i),Qr.encode(o,t)};var pi=function(){throw new Error("unsupported")},yi=Qr.assert;function mi(t){if(!(this instanceof mi))return new mi(t);"string"==typeof t&&(yi(Object.prototype.hasOwnProperty.call(ei,t),"Unknown curve "+t),t=ei[t]),t instanceof ei.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var gi=mi;mi.prototype.keyPair=function(t){return new ai(this,t)},mi.prototype.keyFromPrivate=function(t,e){return ai.fromPrivate(this,t,e)},mi.prototype.keyFromPublic=function(t,e){return ai.fromPublic(this,t,e)},mi.prototype.genKeyPair=function(t){t||(t={});for(var e=new ri({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||pi(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new Rt(2));;){var i=new Rt(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},mi.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},mi.prototype.sign=function(t,e,n,r){"object"==N(n)&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new Rt(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new ri({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new Rt(1)),c=0;;c++){var l=r.k?r.k(c):new Rt(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new ci({r:f,s:p,recoveryParam:y})}}}}}},mi.prototype.verify=function(t,e,n,r){t=this._truncateToN(new Rt(t,16)),n=this.keyFromPublic(n,r);var i=(e=new ci(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},mi.prototype.recoverPubKey=function(t,e,n,r){yi((3&n)===n,"The recovery param is more than two bits"),e=new ci(e,r);var i=this.n,o=new Rt(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},mi.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new ci(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var vi=_r((function(t,e){var n=e;n.version="6.5.4",n.utils=Qr,n.rand=function(){throw new Error("unsupported")},n.curve=ti,n.curves=ei,n.ec=gi,n.eddsa=null})).ec,wi=new Nt("signing-key/5.7.0"),bi=null;function Mi(){return bi||(bi=new vi("secp256k1")),bi}var Ai,Ni=b((function t(e){v(this,t),Oe(this,"curve","secp256k1"),Oe(this,"privateKey",Ct(e)),32!==function(t){if("string"!=typeof t)t=Ct(t);else if(!St(t)||t.length%2)return null;return(t.length-2)/2}(this.privateKey)&&wi.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");var n=Mi().keyFromPrivate(Lt(this.privateKey));Oe(this,"publicKey","0x"+n.getPublic(!1,"hex")),Oe(this,"compressedPublicKey","0x"+n.getPublic(!0,"hex")),Oe(this,"_isSigningKey",!0)}),[{key:"_addPoint",value:function(t){var e=Mi().keyFromPublic(Lt(this.publicKey)),n=Mi().keyFromPublic(Lt(t));return"0x"+e.pub.add(n.pub).encodeCompressed("hex")}},{key:"signDigest",value:function(t){var e=Mi().keyFromPrivate(Lt(this.privateKey)),n=Lt(t);32!==n.length&&wi.throwArgumentError("bad digest length","digest",t);var r=e.sign(n,{canonical:!0});return zt({recoveryParam:r.recoveryParam,r:Ot("0x"+r.r.toString(16),32),s:Ot("0x"+r.s.toString(16),32)})}},{key:"computeSharedSecret",value:function(t){var e=Mi().keyFromPrivate(Lt(this.privateKey)),n=Mi().keyFromPublic(Lt(Ii(t)));return Ot("0x"+e.derive(n.getPublic()).toString(16),32)}}],[{key:"isSigningKey",value:function(t){return!(!t||!t._isSigningKey)}}]);function Ii(t,e){var n=Lt(t);if(32===n.length){var r=new Ni(n);return e?"0x"+Mi().keyFromPrivate(n).getPublic(!0,"hex"):r.publicKey}return 33===n.length?e?Ct(n):"0x"+Mi().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?e?"0x"+Mi().keyFromPublic(n).getPublic(!0,"hex"):Ct(n):wi.throwArgumentError("invalid public or private key","key","[REDACTED]")}function Ei(t,e,n,r,i,o){return L(this,null,A().mark((function a(){return A().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:a.t0=n.t,a.next="eip191"===a.t0?3:"eip1271"===a.t0?4:7;break;case 3:return a.abrupt("return",xi(t,e,n.s));case 4:return a.next=6,ki(t,e,n.s,r,i,o);case 6:return a.abrupt("return",a.sent);case 7:throw new Error("verifySignature failed: Attempted to verify CacaoSignature with unknown type: ".concat(n.t));case 8:case"end":return a.stop()}}),a)})))}function xi(t,e,n){return function(t,e){return function(t){return function(t){var e=null;if("string"!=typeof t&&Te.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Le(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Te.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){for(var e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((function(t){return Se[t]})).join("");e.length>=De;){var n=e.substring(0,De);e=parseInt(n,10)%97+e.substring(n.length)}for(var r=String(98-parseInt(e,10)%97);r.length<2;)r="0"+r;return r}(t)&&Te.throwArgumentError("bad icap checksum","address",t),e=function(t){return new Qt(t,36).toString(16)}(t.substring(4));e.length<40;)e="0"+e;e=Le("0x"+e)}else Te.throwArgumentError("invalid address","address",t);return e}(Dt(Pt(Dt(Ii(t),1)),12))}(function(t,e){var n=zt(e),r={r:Lt(n.r),s:Lt(n.s)};return"0x"+Mi().recoverPubKey(Lt(t),r,n.recoveryParam).encode("hex",!1)}(Lt(t),e))}(ke(e),n).toLowerCase()===t.toLowerCase()}function ki(t,e,n,r,i,o){return L(this,null,A().mark((function a(){var s,u,c,l,h,d,f;return A().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,s="0x1626ba7e",u=n.substring(2),c=ke(e).substring(2),l=s+c+"00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041"+u,a.next=9,fetch("".concat(o||"https://rpc.walletconnect.com/v1","/?chainId=").concat(r,"&projectId=").concat(i),{method:"POST",body:JSON.stringify({id:Date.now()+Math.floor(1e3*Math.random()),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:l},"latest"]})});case 9:return h=a.sent,a.next=12,h.json();case 12:return d=a.sent,f=d.result,a.abrupt("return",!!f&&f.slice(0,s.length).toLowerCase()===s.toLowerCase());case 17:return a.prev=17,a.t0=a.catch(0),a.abrupt("return",(console.error("isValidEip1271Signature: ",a.t0),!1));case 20:case"end":return a.stop()}}),a,null,[[0,17]])})))}new Nt("transactions/5.7.0"),function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(Ai||(Ai={}));var Ti=Object.defineProperty,Li=Object.defineProperties,Si=Object.getOwnPropertyDescriptors,ji=Object.getOwnPropertySymbols,Ci=Object.prototype.hasOwnProperty,Di=Object.prototype.propertyIsEnumerable,Oi=function(t,e,n){return e in t?Ti(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},zi=function(t){return null==t?void 0:t.split(":")},Pi=function(t){var e=t&&zi(t);if(e)return t.includes("did:pkh:")?e[3]:e[1]},_i=function(t){var e=t&&zi(t);if(e)return e[2]+":"+e[3]},Bi=function(t){var e=t&&zi(t);if(e)return e.pop()};function Ri(t){return L(this,null,A().mark((function e(){var n,r,i,o,a,s;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.cacao,r=t.projectId,i=n.s,o=n.p,a=Ui(o,o.iss),s=Bi(o.iss),e.next=3,Ei(s,a,i,Pi(o.iss),r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))}var Ui=function(t,e){var n="".concat(t.domain," wants you to sign in with your Ethereum account:"),r=Bi(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");var i=t.statement||void 0,o="URI: ".concat(t.aud||t.uri),a="Version: ".concat(t.version),s="Chain ID: ".concat(Pi(e)),u="Nonce: ".concat(t.nonce),c="Issued At: ".concat(t.iat),l=t.resources?"Resources:".concat(t.resources.map((function(t){return"\n- ".concat(t)})).join("")):void 0,h=Zi(t.resources);return h&&(i=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0;Qi(e);var n="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(n))return t;var r=[],i=0;Object.keys(e.att).forEach((function(t){var n=Object.keys(e.att[t]).map((function(t){return{ability:t.split("/")[0],action:t.split("/")[1]}}));n.sort((function(t,e){return t.action.localeCompare(e.action)}));var o={};n.forEach((function(t){o[t.ability]||(o[t.ability]=[]),o[t.ability].push(t.action)}));var a=Object.keys(o).map((function(e){return i++,"(".concat(i,") '").concat(e,"': '").concat(o[e].join("', '"),"' for '").concat(t,"'.")}));r.push(a.join(", ").replace(".,","."))}));var o=r.join(" "),a="".concat(n).concat(o);return"".concat(t?t+" ":"").concat(a)}(i,Fi(h))),[n,r,"",i,"",o,a,s,u,c,l].filter((function(t){return null!=t})).join("\n")};function Qi(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");var e=Object.keys(t.att);if(null==e||!e.length)throw new Error("No resources found in `att` property");e.forEach((function(e){var n=t.att[e];if(Array.isArray(n))throw new Error("Resource must be an object: ".concat(e));if("object"!=N(n))throw new Error("Resource must be an object: ".concat(e));if(!Object.keys(n).length)throw new Error("Resource object is empty: ".concat(e));Object.keys(n).forEach((function(t){var e=n[t];if(!Array.isArray(e))throw new Error("Ability limits ".concat(t," must be an array of objects, found: ").concat(e));if(!e.length)throw new Error("Value of ".concat(t," is empty array, must be an array with objects"));e.forEach((function(e){if("object"!=N(e))throw new Error("Ability limits (".concat(t,") must be an array of objects, found: ").concat(e))}))}))}))}function Yi(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(e=null==e?void 0:e.sort((function(t,e){return t.localeCompare(e)}))).map((function(e){return g({},"".concat(t,"/").concat(e),[n])}));return Object.assign.apply(Object,[{}].concat(E(r)))}function Wi(t){return Qi(t),"urn:recap:".concat(function(t){return i.from(JSON.stringify(t)).toString("base64")}(t).replace(/=/g,""))}function Fi(t){var e=function(t){return JSON.parse(i.from(t,"base64").toString("utf-8"))}(t.replace("urn:recap:",""));return Qi(e),e}function Vi(t,e,n){return Wi(function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return null==n||n.sort((function(t,e){return t.localeCompare(e)})),{att:g({},t,Yi(e,n,r))}}(t,e,n))}function Hi(t,e){return Wi(function(t,e){Qi(t),Qi(e);var n=Object.keys(t.att).concat(Object.keys(e.att)).sort((function(t,e){return t.localeCompare(e)})),r={att:{}};return n.forEach((function(n){var i,o;Object.keys((null==(i=t.att)?void 0:i[n])||{}).concat(Object.keys((null==(o=e.att)?void 0:o[n])||{})).sort((function(t,e){return t.localeCompare(e)})).forEach((function(i){var o,a;r.att[n]=function(t,e){return Li(t,Si(e))}(function(t,e){for(var n in e||(e={}))Ci.call(e,n)&&Oi(t,n,e[n]);if(ji){var r,i=I(ji(e));try{for(i.s();!(r=i.n()).done;)n=r.value,Di.call(e,n)&&Oi(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t}({},r.att[n]),g({},i,(null==(o=t.att[n])?void 0:o[i])||(null==(a=e.att[n])?void 0:a[i])))}))})),r}(Fi(t),Fi(e)))}function Gi(t){var e,n=Fi(t);Qi(n);var r=null==(e=n.att)?void 0:e.eip155;return r?Object.keys(r).map((function(t){return t.split("/")[1]})):[]}function qi(t){var e=Fi(t);Qi(e);var n=[];return Object.values(e.att).forEach((function(t){Object.values(t).forEach((function(t){var e;null!=(e=null==t?void 0:t[0])&&e.chains&&n.push(t[0].chains)}))})),E(new Set(n.flat()))}function Zi(t){if(t){var e=null==t?void 0:t[t.length-1];return function(t){return t&&t.includes("urn:recap:")}(e)?e:void 0}}var Ji="base16",Xi="base64pad",Ki="utf8",$i=1;function to(){var t=p.generateKeyPair();return{privateKey:Object(y.toString)(t.secretKey,Ji),publicKey:Object(y.toString)(t.publicKey,Ji)}}function eo(){var t=Object(d.randomBytes)(32);return Object(y.toString)(t,Ji)}function no(t,e){var n=p.sharedKey(Object(y.fromString)(t,Ji),Object(y.fromString)(e,Ji),!0),r=new h.HKDF(f.SHA256,n).expand(32);return Object(y.toString)(r,Ji)}function ro(t){var e=Object(f.hash)(Object(y.fromString)(t,Ji));return Object(y.toString)(e,Ji)}function io(t){var e=Object(f.hash)(Object(y.fromString)(t,Ki));return Object(y.toString)(e,Ji)}function oo(t){return Number(Object(y.toString)(t,"base10"))}function ao(t){var e=function(t){return Object(y.fromString)("".concat(t),"base10")}(N(t.type)<"u"?t.type:0);if(oo(e)===$i&&N(t.senderPublicKey)>"u")throw new Error("Missing sender public key for type 1 envelope");var n=N(t.senderPublicKey)<"u"?Object(y.fromString)(t.senderPublicKey,Ji):void 0,r=N(t.iv)<"u"?Object(y.fromString)(t.iv,Ji):Object(d.randomBytes)(12);return function(t){if(oo(t.type)===$i){if(N(t.senderPublicKey)>"u")throw new Error("Missing sender public key for type 1 envelope");return Object(y.toString)(Object(y.concat)([t.type,t.senderPublicKey,t.iv,t.sealed]),Xi)}return Object(y.toString)(Object(y.concat)([t.type,t.iv,t.sealed]),Xi)}({type:e,sealed:new l.ChaCha20Poly1305(Object(y.fromString)(t.symKey,Ji)).seal(r,Object(y.fromString)(t.message,Ki)),iv:r,senderPublicKey:n})}function so(t){var e=new l.ChaCha20Poly1305(Object(y.fromString)(t.symKey,Ji)),n=uo(t.encoded),r=n.sealed,i=n.iv,o=e.open(i,r);if(null===o)throw new Error("Failed to decrypt");return Object(y.toString)(o,Ki)}function uo(t){var e=Object(y.fromString)(t,Xi),n=e.slice(0,1);if(oo(n)===$i){var r=e.slice(1,33),i=e.slice(33,45);return{type:n,sealed:e.slice(45),iv:i,senderPublicKey:r}}var o=e.slice(1,13);return{type:n,sealed:e.slice(13),iv:o}}function co(t,e){var n=uo(t);return lo({type:oo(n.type),senderPublicKey:N(n.senderPublicKey)<"u"?Object(y.toString)(n.senderPublicKey,Ji):void 0,receiverPublicKey:null==e?void 0:e.receiverPublicKey})}function lo(t){var e=(null==t?void 0:t.type)||0;if(e===$i){if(N(null==t?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(N(null==t?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:null==t?void 0:t.senderPublicKey,receiverPublicKey:null==t?void 0:t.receiverPublicKey}}function ho(t){return t.type===$i&&"string"==typeof t.senderPublicKey&&"string"==typeof t.receiverPublicKey}function fo(t){return(null==t?void 0:t.relay)||{protocol:"irn"}}function po(t){var e=m.RELAY_JSONRPC[t];if(N(e)>"u")throw new Error("Relay Protocol not supported: ".concat(t));return e}var yo=Object.defineProperty,mo=Object.defineProperties,go=Object.getOwnPropertyDescriptors,vo=Object.getOwnPropertySymbols,wo=Object.prototype.hasOwnProperty,bo=Object.prototype.propertyIsEnumerable,Mo=function(t,e,n){return e in t?yo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},Ao=function(t,e){for(var n in e||(e={}))wo.call(e,n)&&Mo(t,n,e[n]);if(vo){var r,i=I(vo(e));try{for(i.s();!(r=i.n()).done;)n=r.value,bo.call(e,n)&&Mo(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t};function No(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",n={},r="relay"+e;return Object.keys(t).forEach((function(e){if(e.startsWith(r)){var i=e.replace(r,""),o=t[e];n[i]=o}})),n}function Io(t){var e=(t=(t=t.includes("wc://")?t.replace("wc://",""):t).includes("wc:")?t.replace("wc:",""):t).indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e),i=t.substring(e+1,n).split("@"),o=N(n)<"u"?t.substring(n):"",a=c.parse(o),s="string"==typeof a.methods?a.methods.split(","):void 0;return{protocol:r,topic:Eo(i[0]),version:parseInt(i[1],10),symKey:a.symKey,relay:No(a),methods:s,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function Eo(t){return t.startsWith("//")?t.substring(2):t}function xo(t){return"".concat(t.protocol,":").concat(t.topic,"@").concat(t.version,"?")+c.stringify(Ao(function(t,e){return mo(t,go(e))}(Ao({symKey:t.symKey},function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",n="relay",r={};return Object.keys(t).forEach((function(i){var o=n+e+i;t[i]&&(r[o]=t[i])})),r}(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function ko(t){var e=[];return t.forEach((function(t){var n=x(t.split(":"),2),r=n[0],i=n[1];e.push("".concat(r,":").concat(i))})),e}function To(t,e){for(var n=function(t){var e={};return null==t||t.forEach((function(t){var n=x(t.split(":"),2),r=n[0],i=n[1];e[r]||(e[r]={accounts:[],chains:[],events:[]}),e[r].accounts.push(t),e[r].chains.push("".concat(r,":").concat(i))})),e}(e=e.map((function(t){return t.replace("did:pkh:","")}))),r=0,i=Object.entries(n);r"u"}function Po(t,e){return!(!e||!zo(t))||"string"==typeof t&&!!t.trim().length}function _o(t,e){return!(!e||!zo(t))||"number"==typeof t&&!isNaN(t)}function Bo(t,e){var n=e.requiredNamespaces,r=Object.keys(t.namespaces),i=Object.keys(n),o=!0;return!!J(i,r)&&(r.forEach((function(e){var r=t.namespaces[e],i=r.accounts,a=r.methods,s=r.events,u=ko(i),c=n[e];J(j(e,c),u)&&J(c.methods,a)&&J(c.events,s)||(o=!1)})),o)}function Ro(t){return!(!Po(t,!1)||!t.includes(":"))&&2===t.split(":").length}function Uo(t){if(Po(t,!1))try{return N(new URL(t))<"u"}catch(t){return!1}return!1}function Qo(t){var e;return null==(e=null==t?void 0:t.proposer)?void 0:e.publicKey}function Yo(t){return null==t?void 0:t.topic}function Wo(t,e){var n=null;return Po(null==t?void 0:t.publicKey,!1)||(n=jo("MISSING_OR_INVALID","".concat(e," controller public key should be a string"))),n}function Fo(t){var e=!0;return Do(t)?t.length&&(e=t.every((function(t){return Po(t,!1)}))):e=!1,e}function Vo(t,e){var n=null;return Object.values(t).forEach((function(t){if(!n){var r=function(t,e){var n=null;return Fo(null==t?void 0:t.methods)?Fo(null==t?void 0:t.events)||(n=Co("UNSUPPORTED_EVENTS","".concat(e,", events should be an array of strings or empty array for no events"))):n=Co("UNSUPPORTED_METHODS","".concat(e,", methods should be an array of strings or empty array for no methods")),n}(t,"".concat(e,", namespace"));r&&(n=r)}})),n}function Ho(t,e,n){var r=null;if(t&&Oo(t)){var i=Vo(t,e);i&&(r=i);var o=function(t,e,n){var r=null;return Object.entries(t).forEach((function(t){var i=x(t,2),o=i[0],a=i[1];if(!r){var s=function(t,e,n){var r=null;return Do(e)&&e.length?e.forEach((function(t){r||Ro(t)||(r=Co("UNSUPPORTED_CHAINS","".concat(n,", chain ").concat(t,' should be a string and conform to "namespace:chainId" format')))})):Ro(t)||(r=Co("UNSUPPORTED_CHAINS","".concat(n,', chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }'))),r}(o,j(o,a),"".concat(e," ").concat(n));s&&(r=s)}})),r}(t,e,n);o&&(r=o)}else r=jo("MISSING_OR_INVALID","".concat(e,", ").concat(n," should be an object with data"));return r}function Go(t,e){var n=null;if(t&&Oo(t)){var r=Vo(t,e);r&&(n=r);var i=function(t,e){var n=null;return Object.values(t).forEach((function(t){if(!n){var r=function(t,e){var n=null;return Do(t)?t.forEach((function(t){n||function(t){if(Po(t,!1)&&t.includes(":")){var e=t.split(":");if(3===e.length){var n=e[0]+":"+e[1];return!!e[2]&&Ro(n)}}return!1}(t)||(n=Co("UNSUPPORTED_ACCOUNTS","".concat(e,", account ").concat(t,' should be a string and conform to "namespace:chainId:address" format')))})):n=Co("UNSUPPORTED_ACCOUNTS","".concat(e,', accounts should be an array of strings conforming to "namespace:chainId:address" format')),n}(null==t?void 0:t.accounts,"".concat(e," namespace"));r&&(n=r)}})),n}(t,e);i&&(n=i)}else n=jo("MISSING_OR_INVALID","".concat(e,", namespaces should be an object with data"));return n}function qo(t){return Po(t.protocol,!0)}function Zo(t,e){var n=!1;return e&&!t?n=!0:t&&Do(t)&&t.length&&t.forEach((function(t){n=qo(t)})),n}function Jo(t){return"number"==typeof t}function Xo(t){return N(t)<"u"&&null!==N(t)}function Ko(t){return!!(t&&"object"==N(t)&&t.code&&_o(t.code,!1)&&t.message&&Po(t.message,!1))}function $o(t){return!(zo(t)||!Po(t.method,!1))}function ta(t){return!(zo(t)||zo(t.result)&&zo(t.error)||!_o(t.id,!1)||!Po(t.jsonrpc,!1))}function ea(t){return!(zo(t)||!Po(t.name,!1))}function na(t,e){return!(!Ro(e)||!function(t){var e=[];return Object.values(t).forEach((function(t){e.push.apply(e,E(ko(t.accounts)))})),e}(t).includes(e))}function ra(t,e,n){return!!Po(n,!1)&&function(t,e){var n=[];return Object.values(t).forEach((function(t){ko(t.accounts).includes(e)&&n.push.apply(n,E(t.methods))})),n}(t,e).includes(n)}function ia(t,e,n){return!!Po(n,!1)&&function(t,e){var n=[];return Object.values(t).forEach((function(t){ko(t.accounts).includes(e)&&n.push.apply(n,E(t.events))})),n}(t,e).includes(n)}function oa(t,e,n){var r=null,i=function(t){var e={};return Object.keys(t).forEach((function(n){var r;n.includes(":")?e[n]=t[n]:null==(r=t[n].chains)||r.forEach((function(r){e[r]={methods:t[n].methods,events:t[n].events}}))})),e}(t),o=function(t){var e={};return Object.keys(t).forEach((function(n){if(n.includes(":"))e[n]=t[n];else{var r=ko(t[n].accounts);null==r||r.forEach((function(r){e[r]={accounts:t[n].accounts.filter((function(t){return t.includes("".concat(r,":"))})),methods:t[n].methods,events:t[n].events}}))}})),e}(e),a=Object.keys(i),s=Object.keys(o),u=aa(Object.keys(t)),c=aa(Object.keys(e)),l=u.filter((function(t){return!c.includes(t)}));return l.length&&(r=jo("NON_CONFORMING_NAMESPACES","".concat(n," namespaces keys don't satisfy requiredNamespaces.\n Required: ").concat(l.toString(),"\n Received: ").concat(Object.keys(e).toString()))),J(a,s)||(r=jo("NON_CONFORMING_NAMESPACES","".concat(n," namespaces chains don't satisfy required namespaces.\n Required: ").concat(a.toString(),"\n Approved: ").concat(s.toString()))),Object.keys(e).forEach((function(t){if(t.includes(":")&&!r){var i=ko(e[t].accounts);i.includes(t)||(r=jo("NON_CONFORMING_NAMESPACES","".concat(n," namespaces accounts don't satisfy namespace accounts for ").concat(t,"\n Required: ").concat(t,"\n Approved: ").concat(i.toString())))}})),a.forEach((function(t){r||(J(i[t].methods,o[t].methods)?J(i[t].events,o[t].events)||(r=jo("NON_CONFORMING_NAMESPACES","".concat(n," namespaces events don't satisfy namespace events for ").concat(t))):r=jo("NON_CONFORMING_NAMESPACES","".concat(n," namespaces methods don't satisfy namespace methods for ").concat(t)))})),r}function aa(t){return E(new Set(t.map((function(t){return t.includes(":")?t.split(":")[0]:t}))))}function sa(t,e){return _o(t,!1)&&t<=e.max&&t>=e.min}function ua(){var t=V();return new Promise((function(e){switch(t){case U:e(F()&&(null==navigator?void 0:navigator.onLine));break;case B:e(function(){return L(this,null,A().mark((function t(){var e;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(W()&&(void 0===r?"undefined":N(r))<"u"&&null!=r&&r.NetInfo)){t.next=5;break}return t.next=3,null==r?void 0:r.NetInfo.fetch();case 3:return e=t.sent,t.abrupt("return",null==e?void 0:e.isConnected);case 5:return t.abrupt("return",!0);case 6:case"end":return t.stop()}}),t)})))}());break;default:e(!0)}}))}function ca(t){switch(V()){case U:!function(t){!W()&&F()&&(window.addEventListener("online",(function(){return t(!0)})),window.addEventListener("offline",(function(){return t(!1)})))}(t);break;case B:!function(t){W()&&(void 0===r?"undefined":N(r))<"u"&&null!=r&&r.NetInfo&&(null==r||r.NetInfo.addEventListener((function(e){return t(null==e?void 0:e.isConnected)})))}(t)}}var la={},ha=b((function t(){v(this,t)}),null,[{key:"get",value:function(t){return la[t]}},{key:"set",value:function(t,e){la[t]=e}},{key:"delete",value:function(t){delete la[t]}}])}).call(this,n(33),n(26),n(116).Buffer)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(16);r.__exportStar(n(76),e),r.__exportStar(n(81),e),r.__exportStar(n(82),e),r.__exportStar(n(45),e)},function(t,e,n){n(7);var r=n(25);n.d(e,"parseConnectionError",(function(){return r.d}));var i=n(54);n.o(i,"IJsonRpcProvider")&&n.d(e,"IJsonRpcProvider",(function(){return i.IJsonRpcProvider})),n.o(i,"formatJsonRpcError")&&n.d(e,"formatJsonRpcError",(function(){return i.formatJsonRpcError})),n.o(i,"formatJsonRpcRequest")&&n.d(e,"formatJsonRpcRequest",(function(){return i.formatJsonRpcRequest})),n.o(i,"formatJsonRpcResult")&&n.d(e,"formatJsonRpcResult",(function(){return i.formatJsonRpcResult})),n.o(i,"getBigIntRpcId")&&n.d(e,"getBigIntRpcId",(function(){return i.getBigIntRpcId})),n.o(i,"isJsonRpcError")&&n.d(e,"isJsonRpcError",(function(){return i.isJsonRpcError})),n.o(i,"isJsonRpcRequest")&&n.d(e,"isJsonRpcRequest",(function(){return i.isJsonRpcRequest})),n.o(i,"isJsonRpcResponse")&&n.d(e,"isJsonRpcResponse",(function(){return i.isJsonRpcResponse})),n.o(i,"isJsonRpcResult")&&n.d(e,"isJsonRpcResult",(function(){return i.isJsonRpcResult})),n.o(i,"isLocalhostUrl")&&n.d(e,"isLocalhostUrl",(function(){return i.isLocalhostUrl})),n.o(i,"isReactNative")&&n.d(e,"isReactNative",(function(){return i.isReactNative})),n.o(i,"isWsUrl")&&n.d(e,"isWsUrl",(function(){return i.isWsUrl})),n.o(i,"payloadId")&&n.d(e,"payloadId",(function(){return i.payloadId}));var o=n(55);n.d(e,"formatJsonRpcError",(function(){return o.a})),n.d(e,"formatJsonRpcRequest",(function(){return o.b})),n.d(e,"formatJsonRpcResult",(function(){return o.c})),n.d(e,"getBigIntRpcId",(function(){return o.d})),n.d(e,"payloadId",(function(){return o.e})),n(56);var a=n(63);n.d(e,"IJsonRpcProvider",(function(){return a.a}));var s=n(57);n.d(e,"isLocalhostUrl",(function(){return s.a})),n.d(e,"isWsUrl",(function(){return s.b}));var u=n(58);n.d(e,"isJsonRpcError",(function(){return u.a})),n.d(e,"isJsonRpcRequest",(function(){return u.b})),n.d(e,"isJsonRpcResponse",(function(){return u.c})),n.d(e,"isJsonRpcResult",(function(){return u.d}))},function(t,e,n){n.d(e,"h",(function(){return r})),n.d(e,"i",(function(){return i})),n.d(e,"f",(function(){return o})),n.d(e,"g",(function(){return a})),n.d(e,"e",(function(){return s})),n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return c})),n.d(e,"d",(function(){return l})),n.d(e,"c",(function(){return h})),n.d(e,"l",(function(){return d})),n.d(e,"k",(function(){return f})),n.d(e,"m",(function(){return p})),n.d(e,"n",(function(){return y})),n.d(e,"j",(function(){return m}));var r="EdDSA",i="JWT",o=".",a="base64url",s="utf8",u="utf8",c=":",l="did",h="key",d="base58btc",f="z",p="K36",y=32,m=32},function(t,e,n){n.d(e,"a",(function(){return D})),n.d(e,"b",(function(){return O})),n.d(e,"c",(function(){return T})),n.d(e,"d",(function(){return j}));var r=n(15),i=n.n(r);n.d(e,"e",(function(){return i.a}));var o=n(8);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nthis.maxSizeInBytes)throw new Error("[LinkedList] Value too big to insert into list: ".concat(t," with size ").concat(e.size));for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}},{key:"shift",value:function(){if(this.head){var t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}}},{key:"toArray",value:function(){for(var t=[],e=this.head;null!==e;)t.push(e.value),e=e.next;return t}},{key:"length",get:function(){return this.lengthInNodes}},{key:"size",get:function(){return this.sizeInBytes}},{key:"toOrderedArray",value:function(){return Array.from(this)}},{key:Symbol.iterator,value:function(){var t=this.head;return{next:function(){if(!t)return{done:!0,value:null};var e=t.value;return t=t.next,{done:!1,value:e}}}}}]),m=l((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,t),this.level=null!=e?e:"error",this.levelValue=r.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new y(this.MAX_LOG_SIZE_IN_BYTES)}),[{key:"forwardToConsole",value:function(t,e){e===r.levels.values.error?console.error(t):e===r.levels.values.warn?console.warn(t):e===r.levels.values.debug?console.debug(t):e===r.levels.values.trace?console.trace(t):console.log(t)}},{key:"appendToLogs",value:function(t){this.logs.append(Object(o.b)({timestamp:(new Date).toISOString(),log:t}));var e="string"==typeof t?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}},{key:"getLogs",value:function(){return this.logs}},{key:"clearLogs",value:function(){this.logs=new y(this.MAX_LOG_SIZE_IN_BYTES)}},{key:"getLogArray",value:function(){return Array.from(this.logs)}},{key:"logsToBlob",value:function(t){var e=this.getLogArray();return e.push(Object(o.b)({extraMetadata:t})),new Blob(e,{type:"application/json"})}}]),g=l((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,t),this.baseChunkLogger=new m(e,n)}),[{key:"write",value:function(t){this.baseChunkLogger.appendToLogs(t)}},{key:"getLogs",value:function(){return this.baseChunkLogger.getLogs()}},{key:"clearLogs",value:function(){this.baseChunkLogger.clearLogs()}},{key:"getLogArray",value:function(){return this.baseChunkLogger.getLogArray()}},{key:"logsToBlob",value:function(t){return this.baseChunkLogger.logsToBlob(t)}},{key:"downloadLogsBlobInBrowser",value:function(t){var e=URL.createObjectURL(this.logsToBlob(t)),n=document.createElement("a");n.href=e,n.download="walletconnect-logs-".concat((new Date).toISOString(),".txt"),document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}}]),v=l((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,t),this.baseChunkLogger=new m(e,n)}),[{key:"write",value:function(t){this.baseChunkLogger.appendToLogs(t)}},{key:"getLogs",value:function(){return this.baseChunkLogger.getLogs()}},{key:"clearLogs",value:function(){this.baseChunkLogger.clearLogs()}},{key:"getLogArray",value:function(){return this.baseChunkLogger.getLogArray()}},{key:"logsToBlob",value:function(t){return this.baseChunkLogger.logsToBlob(t)}}]),w=Object.defineProperty,b=Object.defineProperties,M=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,E=function(t,e,n){return e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},x=function(t,e){for(var n in e||(e={}))N.call(e,n)&&E(t,n,e[n]);if(A){var r,i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}(t))){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw o}}}}(A(e));try{for(i.s();!(r=i.n()).done;)n=r.value,I.call(e,n)&&E(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},k=function(t,e){return b(t,M(e))};function T(t){return k(x({},t),{level:(null==t?void 0:t.level)||"info"})}function L(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;return t[e]||""}function S(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d;return t[n]=e,t}function j(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;return s(t.bindings)>"u"?L(t,e):t.bindings().context||""}function C(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,r=j(t,n);return r.trim()?"".concat(r,"/").concat(e):e}function D(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,r=C(t,e,n),i=t.child({context:r});return S(i,r,n)}function O(t){return s(t.loggerOverride)<"u"&&"string"!=typeof t.loggerOverride?{logger:t.loggerOverride,chunkLoggerController:null}:("undefined"==typeof window?"undefined":s(window))<"u"?function(t){var e,n,r=new g(null==(e=t.opts)?void 0:e.level,t.maxSizeInBytes);return{logger:i()(k(x({},t.opts),{level:"trace",browser:k(x({},null==(n=t.opts)?void 0:n.browser),{write:function(t){return r.write(t)}})})),chunkLoggerController:r}}(t):function(t){var e,n=new v(null==(e=t.opts)?void 0:e.level,t.maxSizeInBytes);return{logger:i()(k(x({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}(t)}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(109),i=n(42),o=n(110),a=n(17),s=n(20),u=n(111);e.compare=r.compare,e.concat=i.concat,e.equals=o.equals,e.fromString=a.fromString,e.toString=s.toString,e.xor=u.xor},function(t,e,n){var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}g(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&g(t,"error",e,{once:!0})}(t,i)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.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?s.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var i,o,a,s;if(c(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=l(t))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return t}function d(){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 f(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function p(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)o(u,this,e);else{var c=u.length,l=m(u,c);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):y.call(t,e)},s.prototype.listenerCount=y,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e,n){var i;return i=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e),(e="symbol"==r(i)?i:i+"")in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}n.d(e,"b",(function(){return o})),n.d(e,"d",(function(){return a})),n.d(e,"c",(function(){return s})),n.d(e,"e",(function(){return u})),n.d(e,"f",(function(){return c})),n.d(e,"a",(function(){return l}));var o="INTERNAL_ERROR",a="SERVER_ERROR",s=[-32700,-32600,-32601,-32602,-32603],u=[-32e3,-32099],c=i(i(i(i(i(i({},"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"}),o,{code:-32603,message:"Internal error"}),a,{code:-32e3,message:"Server error"}),l=a},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){if("string"!=typeof t)throw new Error("Cannot safe json parse value of type ".concat(r(t)));try{return e=t.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3'),JSON.parse(e,(function(t,e){return"string"==typeof e&&e.match(/^\d+n$/)?BigInt(e.substring(0,e.length-1)):e}))}catch(e){return t}var e}function o(t){return"string"==typeof t?t:(e=t,JSON.stringify(e,(function(t,e){return"bigint"==typeof e?e.toString()+"n":e}))||"");var e}n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o}))},function(t,e,n){(function(t){n.d(e,"a",(function(){return Tn})),n.d(e,"b",(function(){return Pe})),n.d(e,"c",(function(){return Ce})),n.d(e,"d",(function(){return we})),n.d(e,"e",(function(){return Ae})),n.d(e,"f",(function(){return mn})),n.d(e,"g",(function(){return Be}));var r=n(6),i=n.n(r),o=n(64),a=n(27),s=n(4),u=n(11),c=n(8),l=n(31),h=n(0),d=n(5),f=n(1),p=n(72),y=n(2),m=n(65),g=n(66),v=n.n(g),w=n(67),b=n.n(w);function M(t){return function(t){if(Array.isArray(t))return P(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||z(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(t,e,n){return e=I(e),function(t,e){if(e&&("object"===k(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return N(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return!!t}()?Reflect.construct(e,n||[],I(t).constructor):e.apply(t,n))}function N(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function I(t){return(I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function E(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&x(t,e)}function x(t,e){return(x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function k(t){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function T(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */T=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof m?e:m,a=Object.create(o.prototype),s=new j(r||[]);return i(a,"_invoke",{value:E(t,n,s)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",f="executing",p="completed",y={};function m(){}function g(){}function v(){}var w={};c(w,a,(function(){return this}));var b=Object.getPrototypeOf,M=b&&b(b(C([])));M&&M!==n&&r.call(M,a)&&(w=M);var A=v.prototype=m.prototype=Object.create(w);function N(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function n(i,o,a,s){var u=h(t[i],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==k(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function E(e,n,r){var i=d;return function(o,a){if(i===f)throw Error("Generator is already running");if(i===p){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var u=x(s,r);if(u){if(u===y)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=h(e,n,r);if("normal"===c.type){if(i=r.done?p:"suspendedYield",c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=p,r.method="throw",r.arg=c.arg)}}}function x(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,x(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=h(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function L(t,e,n){return(e=D(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function S(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function j(t,e){for(var n=0;n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function z(t,e){if(t){if("string"==typeof t)return P(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r>>0,a=new Uint8Array(o);t[e];){var l=n[t.charCodeAt(e)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h>>0,a[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,e++}if(" "!==t[e]){for(var f=o-i;f!==o&&0===a[f];)f++;for(var p=new Uint8Array(r+(o-f)),y=r;f!==o;)p[y++]=a[f++];return p}}}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var a=(o-i)*l+1>>>0,c=new Uint8Array(a);i!==o;){for(var h=e[i],d=0,f=a-1;(0!==h||d>>0,c[f]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=a-r;p!==a&&0===c[p];)p++;for(var y=u.repeat(n);pn;)o+=e[i&s>>(a-=n)];if(a&&(o+=e[i&s<=8&&(u-=8,s[l++]=255&c>>u)}if(u>=n||255&c<<8-u)throw new SyntaxError("Unexpected end of data");return s}(t,i,r,e)}})},$=J({prefix:"\0",name:"identity",encode:function(t){return function(t){return(new TextDecoder).decode(t)}(t)},decode:function(t){return function(t){return(new TextEncoder).encode(t)}(t)}}),tt=Object.freeze({__proto__:null,identity:$}),et=K({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),nt=Object.freeze({__proto__:null,base2:et}),rt=K({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),it=Object.freeze({__proto__:null,base8:rt}),ot=X({prefix:"9",name:"base10",alphabet:"0123456789"}),at=Object.freeze({__proto__:null,base10:ot}),st=K({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ut=K({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),ct=Object.freeze({__proto__:null,base16:st,base16upper:ut}),lt=K({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ht=K({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),dt=K({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ft=K({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pt=K({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),yt=K({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),mt=K({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gt=K({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),vt=K({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),wt=Object.freeze({__proto__:null,base32:lt,base32upper:ht,base32pad:dt,base32padupper:ft,base32hex:pt,base32hexupper:yt,base32hexpad:mt,base32hexpadupper:gt,base32z:vt}),bt=X({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Mt=X({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),At=Object.freeze({__proto__:null,base36:bt,base36upper:Mt}),Nt=X({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),It=X({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Et=Object.freeze({__proto__:null,base58btc:Nt,base58flickr:It}),xt=K({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),kt=K({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Tt=K({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Lt=K({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),St=Object.freeze({__proto__:null,base64:xt,base64pad:kt,base64url:Tt,base64urlpad:Lt}),jt=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Ct=jt.reduce((function(t,e,n){return t[n]=e,t}),[]),Dt=jt.reduce((function(t,e,n){return t[e.codePointAt(0)]=n,t}),[]),Ot=J({prefix:"🚀",name:"base256emoji",encode:function(t){return t.reduce((function(t,e){return t+Ct[e]}),"")},decode:function(t){var e,n=[],r=O(t);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Dt[i.codePointAt(0)];if(void 0===o)throw new Error("Non-base256emoji character: ".concat(i));n.push(o)}}catch(t){r.e(t)}finally{r.f()}return new Uint8Array(n)}}),zt=Object.freeze({__proto__:null,base256emoji:Ot}),Pt=Math.pow(2,31),_t=Math.pow(2,7),Bt=Math.pow(2,14),Rt=Math.pow(2,21),Ut=Math.pow(2,28),Qt=Math.pow(2,35),Yt=Math.pow(2,42),Wt=Math.pow(2,49),Ft=Math.pow(2,56),Vt=Math.pow(2,63),Ht=function t(e,n,r){n=n||[];for(var i=r=r||0;e>=Pt;)n[r++]=255&e|128,e/=128;for(;-128&e;)n[r++]=255&e|128,e>>>=7;return n[r]=0|e,t.bytes=r-i+1,n},Gt=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Ht(t,e,n),e},qt=function(t){return function(t){return t<_t?1:t0&&void 0!==arguments[0]?arguments[0]:0;return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?se(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}((t=t.substring(1)).length),n=0;n1&&void 0!==arguments[1]?arguments[1]:"utf8",n=he[e];if(!n)throw new Error('Unsupported encoding "'.concat(e,'"'));return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode("".concat(n.prefix).concat(t)):se(globalThis.Buffer.from(t,"utf-8"))}var fe="core",pe="".concat("wc","@2:").concat(fe,":"),ye={database:":memory:"},me="client_ed25519_seed",ge=f.ONE_DAY,ve=f.SIX_HOURS,we="irn",be="wss://relay.walletconnect.com",Me="wss://relay.walletconnect.org",Ae={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Ne="payload",Ie="connect",Ee="disconnect",xe="error",ke=f.ONE_SECOND,Te="subscription_created",Le="subscription_deleted",Se=(f.THIRTY_DAYS,1e3*f.FIVE_SECONDS),je=(f.THIRTY_DAYS,{wc_pairingDelete:{req:{ttl:f.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:f.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:f.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:f.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:f.ONE_DAY,prompt:!1,tag:0},res:{ttl:f.ONE_DAY,prompt:!1,tag:0}}}),Ce={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},De="history_created",Oe="history_updated",ze="history_deleted",Pe={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},_e=(f.ONE_DAY,"verify-api"),Be="https://verify.walletconnect.com",Re="https://verify.walletconnect.org",Ue=[Be,Re],Qe=C((function t(e,n){var r=this;S(this,t),this.core=e,this.logger=n,this.keychain=new Map,this.name="keychain",this.version="0.3",this.initialized=!1,this.storagePrefix=pe,this.init=function(){return W(r,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.initialized){t.next=5;break}return t.next=3,this.getKeyChain();case 3:k(e=t.sent)<"u"&&(this.keychain=e),this.initialized=!0;case 5:case"end":return t.stop()}}),t,this)})))},this.has=function(t){return r.isInitialized(),r.keychain.has(t)},this.set=function(t,e){return W(r,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.keychain.set(t,e),n.next=4,this.persist();case 4:case"end":return n.stop()}}),n,this)})))},this.get=function(t){r.isInitialized();var e=r.keychain.get(t);if(k(e)>"u"){var n=Object(h.A)("NO_MATCHING_KEY","".concat(r.name,": ").concat(t)).message;throw new Error(n)}return e},this.del=function(t){return W(r,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),this.keychain.delete(t),e.next=4,this.persist();case 4:case"end":return e.stop()}}),e,this)})))},this.core=e,this.logger=Object(s.a)(n,this.name)}),[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"setKeyChain",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,Object(h.ob)(t));case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getKeyChain",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return e=t.sent,t.abrupt("return",k(e)<"u"?Object(h.qb)(e):void 0);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setKeyChain(this.keychain);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}]),Ye=C((function t(e,n,r){var i=this;S(this,t),this.core=e,this.logger=n,this.name="crypto",this.initialized=!1,this.init=function(){return W(i,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=5;break}return t.next=4,this.keychain.init();case 4:this.initialized=!0;case 5:case"end":return t.stop()}}),t,this)})))},this.hasKeys=function(t){return i.isInitialized(),i.keychain.has(t)},this.getClientId=function(){return W(i,null,T().mark((function t(){var e,n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isInitialized(),t.next=3,this.getClientSeed();case 3:return e=t.sent,n=l.generateKeyPair(e),t.abrupt("return",l.encodeIss(n.publicKey));case 6:case"end":return t.stop()}}),t,this)})))},this.generateKeyPair=function(){i.isInitialized();var t=Object(h.t)();return i.setPrivateKey(t.publicKey,t.privateKey)},this.signJWT=function(t){return W(i,null,T().mark((function e(){var n,r,i,o;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.getClientSeed();case 3:return n=e.sent,r=l.generateKeyPair(n),i=Object(h.u)(),o=ge,e.next=9,l.signJWT(i,t,o,r);case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e,this)})))},this.generateSharedKey=function(t,e,n){i.isInitialized();var r=i.getPrivateKey(t),o=Object(h.k)(r,e);return i.setSymKey(o,n)},this.setSymKey=function(t,e){return W(i,null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),r=e||Object(h.I)(t),n.next=4,this.keychain.set(r,t);case 4:return n.abrupt("return",r);case 5:case"end":return n.stop()}}),n,this)})))},this.deleteKeyPair=function(t){return W(i,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.keychain.del(t);case 3:case"end":return e.stop()}}),e,this)})))},this.deleteSymKey=function(t){return W(i,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.keychain.del(t);case 3:case"end":return e.stop()}}),e,this)})))},this.encode=function(t,e,n){return W(i,null,T().mark((function r(){var i,o,a,s,u,l,d;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this.isInitialized(),i=Object(h.wb)(n),o=Object(c.b)(e),!Object(h.T)(i)){r.next=7;break}return a=i.senderPublicKey,s=i.receiverPublicKey,r.next=6,this.generateSharedKey(a,s);case 6:t=r.sent;case 7:return u=this.getSymKey(t),l=i.type,d=i.senderPublicKey,r.abrupt("return",Object(h.m)({type:l,symKey:u,message:o,senderPublicKey:d}));case 9:case"end":return r.stop()}}),r,this)})))},this.decode=function(t,e,n){return W(i,null,T().mark((function r(){var i,o,a,s,u;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this.isInitialized(),i=Object(h.vb)(e,n),!Object(h.T)(i)){r.next=7;break}return o=i.receiverPublicKey,a=i.senderPublicKey,r.next=6,this.generateSharedKey(o,a);case 6:t=r.sent;case 7:return r.prev=7,s=this.getSymKey(t),u=Object(h.j)({symKey:s,encoded:e}),r.abrupt("return",Object(c.a)(u));case 12:return r.prev=12,r.t0=r.catch(7),r.t1=this.logger,r.t2="Failed to decode message from topic: '".concat(t,"', clientId: '"),r.next=18,this.getClientId();case 18:r.t3=r.sent,r.t4=r.t2.concat.call(r.t2,r.t3,"'"),r.t1.error.call(r.t1,r.t4),this.logger.error(r.t0);case 22:case"end":return r.stop()}}),r,this,[[7,12]])})))},this.getPayloadType=function(t){var e=Object(h.l)(t);return Object(h.i)(e.type)},this.getPayloadSenderPublicKey=function(t){var e=Object(h.l)(t);return e.senderPublicKey?Object(d.toString)(e.senderPublicKey,h.a):void 0},this.core=e,this.logger=Object(s.a)(n,this.name),this.keychain=r||new Qe(this.core,this.logger)}),[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"setPrivateKey",value:function(t,e){return W(this,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.keychain.set(t,e);case 2:return n.abrupt("return",t);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"getPrivateKey",value:function(t){return this.keychain.get(t)}},{key:"getClientSeed",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e="",t.prev=1,e=this.keychain.get(me),t.next=10;break;case 5:return t.prev=5,t.t0=t.catch(1),e=Object(h.u)(),t.next=10,this.keychain.set(me,e);case 10:return t.abrupt("return",de(e,"base16"));case 11:case"end":return t.stop()}}),t,this,[[1,5]])})))}},{key:"getSymKey",value:function(t){return this.keychain.get(t)}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}]),We=function(t){function e(t,n){var r;return S(this,e),(r=A(this,e,[t,n])).logger=t,r.core=n,r.messages=new Map,r.name="messages",r.version="0.3",r.initialized=!1,r.storagePrefix=pe,r.init=function(){return W(N(r),null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.initialized){t.next=15;break}return this.logger.trace("Initialized"),t.prev=2,t.next=5,this.getRelayerMessages();case 5:k(e=t.sent)<"u"&&(this.messages=e),this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",size:this.messages.size}),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(2),this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(t.t0);case 12:return t.prev=12,this.initialized=!0,t.finish(12);case 15:case"end":return t.stop()}}),t,this,[[2,9,12,15]])})))},r.set=function(t,e){return W(N(r),null,T().mark((function n(){var r,i;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),r=Object(h.J)(e),k(i=this.messages.get(t))>"u"&&(i={}),n.t0=k(i[r])<"u",n.t0){n.next=10;break}return i[r]=e,this.messages.set(t,i),n.next=10,this.persist();case 10:return n.abrupt("return",r);case 11:case"end":return n.stop()}}),n,this)})))},r.get=function(t){r.isInitialized();var e=r.messages.get(t);return k(e)>"u"&&(e={}),e},r.has=function(t,e){return r.isInitialized(),k(r.get(t)[Object(h.J)(e)])<"u"},r.del=function(t){return W(N(r),null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),this.messages.delete(t),e.next=4,this.persist();case 4:case"end":return e.stop()}}),e,this)})))},r.logger=Object(s.a)(t,r.name),r.core=n,r}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"setRelayerMessages",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,Object(h.ob)(t));case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getRelayerMessages",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return e=t.sent,t.abrupt("return",k(e)<"u"?Object(h.qb)(e):void 0);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setRelayerMessages(this.messages);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.f),Fe=function(t){function e(t,n){var i;return S(this,e),(i=A(this,e,[t,n])).relayer=t,i.logger=n,i.events=new r.EventEmitter,i.name="publisher",i.queue=new Map,i.publishTimeout=Object(f.toMiliseconds)(f.ONE_MINUTE),i.failedPublishTimeout=Object(f.toMiliseconds)(f.ONE_SECOND),i.needsTransportRestart=!1,i.publish=function(t,e,n){return W(N(i),null,T().mark((function r(){var i,o,a,s,u,c,l,d,f,p,m,g=this;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:t,message:e,opts:n}}),o=(null==n?void 0:n.ttl)||ve,a=Object(h.F)(n),s=(null==n?void 0:n.prompt)||!1,u=(null==n?void 0:n.tag)||0,c=(null==n?void 0:n.id)||Object(y.getBigIntRpcId)().toString(),l={topic:t,message:e,opts:{ttl:o,relay:a,prompt:s,tag:u,id:c}},d="Failed to publish payload, please try again. id:".concat(c," tag:").concat(u),f=Date.now(),m=1,r.prev=3;case 4:if(void 0!==p){r.next=20;break}if(!(Date.now()-f>this.publishTimeout)){r.next=7;break}throw new Error(d);case 7:return this.logger.trace({id:c,attempts:m},"publisher.publish - attempt ".concat(m)),r.next=10,Object(h.h)(this.rpcPublish(t,e,o,a,s,u,c).catch((function(t){return g.logger.warn(t)})),this.publishTimeout,d);case 10:return r.next=12,r.sent;case 12:if(p=r.sent,m++,r.t0=p,r.t0){r.next=18;break}return r.next=18,new Promise((function(t){return setTimeout(t,g.failedPublishTimeout)}));case 18:r.next=4;break;case 20:this.relayer.events.emit(Ae.publish,l),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:c,topic:t,message:e,opts:n}}),r.next=28;break;case 23:if(r.prev=23,r.t1=r.catch(3),this.logger.debug("Failed to Publish Payload"),this.logger.error(r.t1),null==(i=null==n?void 0:n.internal)||!i.throwOnFailedPublish){r.next=27;break}throw r.t1;case 27:this.queue.set(c,l);case 28:case"end":return r.stop()}}),r,this,[[3,23]])})))},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.relayer=t,i.logger=Object(s.a)(n,i.name),i.registerEventListeners(),i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"rpcPublish",value:function(t,e,n,r,i,o,a){var s,u,c,l,d={method:Object(h.E)(r.protocol).publish,params:{topic:t,message:e,ttl:n,prompt:i,tag:o},id:a};return Object(h.U)(null==(s=d.params)?void 0:s.prompt)&&(null==(u=d.params)||delete u.prompt),Object(h.U)(null==(c=d.params)?void 0:c.tag)&&(null==(l=d.params)||delete l.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}},{key:"removeRequestFromQueue",value:function(t){this.queue.delete(t)}},{key:"checkQueue",value:function(){var t=this;this.queue.forEach((function(e){return W(t,null,T().mark((function t(){var n,r,i;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.topic,r=e.message,i=e.opts,t.next=3,this.publish(n,r,i);case 3:case"end":return t.stop()}}),t,this)})))}))}},{key:"registerEventListeners",value:function(){var t=this;this.relayer.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){if(t.needsTransportRestart)return t.needsTransportRestart=!1,void t.relayer.events.emit(Ae.connection_stalled);t.checkQueue()})),this.relayer.on(Ae.message_ack,(function(e){t.removeRequestFromQueue(e.id.toString())}))}}])}(u.g),Ve=C((function t(){var e=this;S(this,t),this.map=new Map,this.set=function(t,n){var r=e.get(t);e.exists(t,n)||e.map.set(t,[].concat(M(r),[n]))},this.get=function(t){return e.map.get(t)||[]},this.exists=function(t,n){return e.get(t).includes(n)},this.delete=function(t,n){if(k(n)>"u")e.map.delete(t);else if(e.map.has(t)){var r=e.get(t);if(e.exists(t,n)){var i=r.filter((function(t){return t!==n}));i.length?e.map.set(t,i):e.map.delete(t)}}},this.clear=function(){e.map.clear()}}),[{key:"topics",get:function(){return Array.from(this.map.keys())}}]),He=Object.defineProperty,Ge=Object.defineProperties,qe=Object.getOwnPropertyDescriptors,Ze=Object.getOwnPropertySymbols,Je=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,Ke=function(t,e,n){return e in t?He(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},$e=function(t,e){for(var n in e||(e={}))Je.call(e,n)&&Ke(t,n,e[n]);if(Ze){var r,i=O(Ze(e));try{for(i.s();!(r=i.n()).done;)n=r.value,Xe.call(e,n)&&Ke(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},tn=function(t,e){return Ge(t,qe(e))},en=function(t){function e(t,n){var i;return S(this,e),(i=A(this,e,[t,n])).relayer=t,i.logger=n,i.subscriptions=new Map,i.topicMap=new Ve,i.events=new r.EventEmitter,i.name="subscription",i.version="0.3",i.pending=new Map,i.cached=[],i.initialized=!1,i.pendingSubscriptionWatchLabel="pending_sub_watch_label",i.pollingInterval=20,i.storagePrefix=pe,i.subscribeTimeout=Object(f.toMiliseconds)(f.ONE_MINUTE),i.restartInProgress=!1,i.batchSubscribeTopicsLimit=500,i.init=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=7;break}return this.logger.trace("Initialized"),this.registerEventListeners(),t.next=6,this.relayer.core.crypto.getClientId();case 6:this.clientId=t.sent;case 7:case"end":return t.stop()}}),t,this)})))},i.subscribe=function(t,e){return W(N(i),null,T().mark((function n(){var r,i,o;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.restartToComplete();case 2:return this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:t,opts:e}}),n.prev=5,r=Object(h.F)(e),i={topic:t,relay:r},this.pending.set(t,i),n.next=10,this.rpcSubscribe(t,r);case 10:return o=n.sent,n.abrupt("return",("string"==typeof o&&(this.onSubscribe(o,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:t,opts:e}})),o));case 14:throw n.prev=14,n.t0=n.catch(5),this.logger.debug("Failed to Subscribe Topic"),this.logger.error(n.t0),n.t0;case 17:case"end":return n.stop()}}),n,this,[[5,14]])})))},i.unsubscribe=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.restartToComplete();case 2:if(this.isInitialized(),!(k(null==e?void 0:e.id)<"u")){n.next=8;break}return n.next=6,this.unsubscribeById(t,e.id,e);case 6:n.next=10;break;case 8:return n.next=10,this.unsubscribeByTopic(t,e);case 10:case"end":return n.stop()}}),n,this)})))},i.isSubscribed=function(t){return W(N(i),null,T().mark((function e(){var n,r=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.topics.includes(t)){e.next=2;break}return e.abrupt("return",!0);case 2:return n="".concat(this.pendingSubscriptionWatchLabel,"_").concat(t),e.next=5,new Promise((function(e,i){var o=new f.Watch;o.start(n);var a=setInterval((function(){!r.pending.has(t)&&r.topics.includes(t)&&(clearInterval(a),o.stop(n),e(!0)),o.elapsed(n)>=Se&&(clearInterval(a),o.stop(n),i(new Error("Subscription resolution timeout")))}),r.pollingInterval)})).catch((function(){return!1}));case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})))},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.start=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.onConnect();case 2:case"end":return t.stop()}}),t,this)})))},i.stop=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.onDisconnect();case 2:case"end":return t.stop()}}),t,this)})))},i.restart=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.restartInProgress=!0,t.next=3,this.restore();case 3:return t.next=5,this.reset();case 5:this.restartInProgress=!1;case 6:case"end":return t.stop()}}),t,this)})))},i.relayer=t,i.logger=Object(s.a)(n,i.name),i.clientId="",i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.subscriptions.size}},{key:"ids",get:function(){return Array.from(this.subscriptions.keys())}},{key:"values",get:function(){return Array.from(this.subscriptions.values())}},{key:"topics",get:function(){return this.topicMap.topics}},{key:"hasSubscription",value:function(t,e){var n=!1;try{n=this.getSubscription(t).topic===e}catch(t){}return n}},{key:"onEnable",value:function(){this.cached=[],this.initialized=!0}},{key:"onDisable",value:function(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}},{key:"unsubscribeByTopic",value:function(t,e){return W(this,null,T().mark((function n(){var r,i=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=this.topicMap.get(t),n.next=3,Promise.all(r.map((function(n){return W(i,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.unsubscribeById(t,n,e);case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))})));case 3:case"end":return n.stop()}}),n,this)})))}},{key:"unsubscribeById",value:function(t,e,n){return W(this,null,T().mark((function r(){var i,o;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}}),r.prev=1,i=Object(h.F)(n),r.next=5,this.rpcUnsubscribe(t,e,i);case 5:return o=Object(h.G)("USER_DISCONNECTED","".concat(this.name,", ").concat(t)),r.next=8,this.onUnsubscribe(t,e,o);case 8:this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}}),r.next=15;break;case 12:throw r.prev=12,r.t0=r.catch(1),this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(r.t0),r.t0;case 15:case"end":return r.stop()}}),r,this,[[1,12]])})))}},{key:"rpcSubscribe",value:function(t,e){return W(this,null,T().mark((function n(){var r,i=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r={method:Object(h.E)(e.protocol).subscribe,params:{topic:t}},this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),n.prev=2,n.next=5,Object(h.h)(this.relayer.request(r).catch((function(t){return i.logger.warn(t)})),this.subscribeTimeout);case 5:return n.next=7,n.sent;case 7:if(!n.sent){n.next=11;break}n.t0=Object(h.J)(t+this.clientId),n.next=12;break;case 11:n.t0=null;case 12:return n.abrupt("return",n.t0);case 15:n.prev=15,n.t1=n.catch(2),this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ae.connection_stalled);case 18:return n.abrupt("return",null);case 19:case"end":return n.stop()}}),n,this,[[2,15]])})))}},{key:"rpcBatchSubscribe",value:function(t){return W(this,null,T().mark((function e(){var n,r,i=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length){e.next=2;break}return e.abrupt("return");case 2:return n=t[0].relay,r={method:Object(h.E)(n.protocol).batchSubscribe,params:{topics:t.map((function(t){return t.topic}))}},this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),e.prev=4,e.next=7,Object(h.h)(this.relayer.request(r).catch((function(t){return i.logger.warn(t)})),this.subscribeTimeout);case 7:return e.next=9,e.sent;case 9:return e.abrupt("return",e.sent);case 12:e.prev=12,e.t0=e.catch(4),this.relayer.events.emit(Ae.connection_stalled);case 15:case"end":return e.stop()}}),e,this,[[4,12]])})))}},{key:"rpcUnsubscribe",value:function(t,e,n){var r={method:Object(h.E)(n.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}},{key:"onSubscribe",value:function(t,e){this.setSubscription(t,tn($e({},e),{id:t})),this.pending.delete(e.topic)}},{key:"onBatchSubscribe",value:function(t){var e=this;t.length&&t.forEach((function(t){e.setSubscription(t.id,$e({},t)),e.pending.delete(t.topic)}))}},{key:"onUnsubscribe",value:function(t,e,n){return W(this,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,n),r.next=4,this.relayer.messages.del(t);case 4:case"end":return r.stop()}}),r,this)})))}},{key:"setRelayerSubscriptions",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.relayer.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getRelayerSubscriptions",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.relayer.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"setSubscription",value:function(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}},{key:"addSubscription",value:function(t,e){this.subscriptions.set(t,$e({},e)),this.topicMap.set(e.topic,t),this.events.emit(Te,e)}},{key:"getSubscription",value:function(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});var e=this.subscriptions.get(t);if(!e){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw new Error(n)}return e}},{key:"deleteSubscription",value:function(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});var n=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(n.topic,t),this.events.emit(Le,tn($e({},n),{reason:e}))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setRelayerSubscriptions(this.values);case 2:this.events.emit("subscription_sync");case 3:case"end":return t.stop()}}),t,this)})))}},{key:"reset",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.cached.length){t.next=10;break}e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit),n=0;case 3:if(!(n"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.subscriptions.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),this.logger.error("".concat(this.name,": ").concat(JSON.stringify(this.values))),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored subscriptions for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",subscriptions:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore subscriptions for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"batchSubscribe",value:function(t){return W(this,null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.rpcBatchSubscribe(t);case 4:n=e.sent,Object(h.V)(n)&&this.onBatchSubscribe(n.map((function(e,n){return tn($e({},t[n]),{id:e})})));case 6:case"end":return e.stop()}}),e,this)})))}},{key:"onConnect",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.restart();case 2:this.onEnable();case 3:case"end":return t.stop()}}),t,this)})))}},{key:"onDisconnect",value:function(){this.onDisable()}},{key:"checkPending",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.initialized&&this.relayer.connected){t.next=2;break}return t.abrupt("return");case 2:return e=[],this.pending.forEach((function(t){e.push(t)})),t.next=6,this.batchSubscribe(e);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"registerEventListeners",value:function(){var t=this;this.relayer.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){return W(t,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.checkPending();case 2:case"end":return t.stop()}}),t,this)})))})),this.events.on(Te,(function(e){return W(t,null,T().mark((function t(){var n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Te,this.logger.info("Emitting ".concat(n)),this.logger.debug({type:"event",event:n,data:e}),t.next=5,this.persist();case 5:case"end":return t.stop()}}),t,this)})))})),this.events.on(Le,(function(e){return W(t,null,T().mark((function t(){var n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Le,this.logger.info("Emitting ".concat(n)),this.logger.debug({type:"event",event:n,data:e}),t.next=5,this.persist();case 5:case"end":return t.stop()}}),t,this)})))}))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}},{key:"restartToComplete",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.restartInProgress,!t.t0){t.next=4;break}return t.next=4,new Promise((function(t){var n=setInterval((function(){e.restartInProgress||(clearInterval(n),t())}),e.pollingInterval)}));case 4:case"end":return t.stop()}}),t,this)})))}}])}(u.k),nn=Object.defineProperty,rn=Object.getOwnPropertySymbols,on=Object.prototype.hasOwnProperty,an=Object.prototype.propertyIsEnumerable,sn=function(t,e,n){return e in t?nn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},un=function(t,e){for(var n in e||(e={}))on.call(e,n)&&sn(t,n,e[n]);if(rn){var r,i=O(rn(e));try{for(i.s();!(r=i.n()).done;)n=r.value,an.call(e,n)&&sn(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},cn=function(t){function e(t){var n;return S(this,e),(n=A(this,e,[t])).protocol="wc",n.version=2,n.events=new r.EventEmitter,n.name="relayer",n.transportExplicitlyClosed=!1,n.initialized=!1,n.connectionAttemptInProgress=!1,n.connectionStatusPollingInterval=20,n.staleConnectionErrors=["socket hang up","socket stalled","interrupted"],n.hasExperiencedNetworkDisruption=!1,n.requestsInFlight=new Map,n.heartBeatTimeout=Object(f.toMiliseconds)(f.THIRTY_SECONDS+f.ONE_SECOND),n.request=function(t){return W(N(n),null,T().mark((function e(){var n,r,i,o,a,s=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.debug("Publishing Request Payload"),i=t.id||Object(y.getBigIntRpcId)().toString(),e.next=4,this.toEstablishConnection();case 4:return e.prev=4,o=this.provider.request(t),this.requestsInFlight.set(i,{promise:o,request:t}),this.logger.trace({id:i,method:t.method,topic:null==(n=t.params)?void 0:n.topic},"relayer.request - attempt to publish..."),e.next=9,new Promise((function(t,e){return W(s,null,T().mark((function n(){var r,a;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function(){e(new Error("relayer.request - publish interrupted, id: ".concat(i)))},this.provider.on(Ee,r),n.next=4,o;case 4:a=n.sent,this.provider.off(Ee,r),t(a);case 6:case"end":return n.stop()}}),n,this)})))}));case 9:return a=e.sent,e.abrupt("return",(this.logger.trace({id:i,method:t.method,topic:null==(r=t.params)?void 0:r.topic},"relayer.request - published"),a));case 13:throw e.prev=13,e.t0=e.catch(4),this.logger.debug("Failed to Publish Request: ".concat(i)),e.t0;case 16:return e.prev=16,this.requestsInFlight.delete(i),e.finish(16);case 19:case"end":return e.stop()}}),e,this,[[4,13,16,19]])})))},n.resetPingTimeout=function(){if(Object(h.N)())try{clearTimeout(n.pingTimeout),n.pingTimeout=setTimeout((function(){var t,e,r;null==(r=null==(e=null==(t=n.provider)?void 0:t.connection)?void 0:e.socket)||r.terminate()}),n.heartBeatTimeout)}catch(t){n.logger.warn(t)}},n.onPayloadHandler=function(t){n.onProviderPayload(t),n.resetPingTimeout()},n.onConnectHandler=function(){n.startPingTimeout(),n.events.emit(Ae.connect)},n.onDisconnectHandler=function(){n.onProviderDisconnect()},n.onProviderErrorHandler=function(t){n.logger.error(t),n.events.emit(Ae.error,t),n.logger.info("Fatal socket error received, closing transport"),n.transportClose()},n.registerProviderListeners=function(){n.provider.on(Ne,n.onPayloadHandler),n.provider.on(Ie,n.onConnectHandler),n.provider.on(Ee,n.onDisconnectHandler),n.provider.on(xe,n.onProviderErrorHandler)},n.core=t.core,n.logger=k(t.logger)<"u"&&"string"!=typeof t.logger?Object(s.a)(t.logger,n.name):Object(s.e)(Object(s.c)({level:t.logger||"error"})),n.messages=new We(n.logger,t.core),n.subscriber=new en(N(n),n.logger),n.publisher=new Fe(N(n),n.logger),n.relayUrl=(null==t?void 0:t.relayUrl)||be,n.projectId=t.projectId,n.bundleId=Object(h.w)(),n.provider={},n}return E(e,t),C(e,[{key:"init",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.logger.trace("Initialized"),this.registerEventListeners(),t.next=4,this.createProvider();case 4:return t.next=6,Promise.all([this.messages.init(),this.subscriber.init()]);case 6:return t.prev=6,t.next=9,this.transportOpen();case 9:t.next=16;break;case 11:return t.prev=11,t.t0=t.catch(6),this.logger.warn("Connection via ".concat(this.relayUrl," failed, attempting to connect via failover domain ").concat(Me,"...")),t.next=16,this.restartTransport(Me);case 16:this.initialized=!0,setTimeout((function(){return W(e,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=0===this.subscriber.topics.length&&0===this.subscriber.pending.size,!t.t0){t.next=6;break}return this.logger.info("No topics subscribed to after init, closing transport"),t.next=5,this.transportClose();case 5:this.transportExplicitlyClosed=!1;case 6:case"end":return t.stop()}}),t,this)})))}),1e4);case 17:case"end":return t.stop()}}),t,this,[[6,11]])})))}},{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"connected",get:function(){var t,e,n;return 1===(null==(n=null==(e=null==(t=this.provider)?void 0:t.connection)?void 0:e.socket)?void 0:n.readyState)}},{key:"connecting",get:function(){var t,e,n;return 0===(null==(n=null==(e=null==(t=this.provider)?void 0:t.connection)?void 0:e.socket)?void 0:n.readyState)}},{key:"publish",value:function(t,e,n){return W(this,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.isInitialized(),r.next=3,this.publisher.publish(t,e,n);case 3:return r.next=5,this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now()});case 5:case"end":return r.stop()}}),r,this)})))}},{key:"subscribe",value:function(t,e){return W(this,null,T().mark((function n(){var r,i,o,a,s=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),i=(null==(r=this.subscriber.topicMap.get(t))?void 0:r[0])||"",a=function e(n){n.topic===t&&(s.subscriber.off(Te,e),o())},n.next=5,Promise.all([new Promise((function(t){o=t,s.subscriber.on(Te,a)})),new Promise((function(n){return W(s,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.subscriber.subscribe(t,e);case 2:if(r.t0=r.sent,r.t0){r.next=5;break}r.t0=i;case 5:i=r.t0,n();case 7:case"end":return r.stop()}}),r,this)})))}))]);case 5:return n.abrupt("return",i);case 6:case"end":return n.stop()}}),n,this)})))}},{key:"unsubscribe",value:function(t,e){return W(this,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),n.next=3,this.subscriber.unsubscribe(t,e);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"on",value:function(t,e){this.events.on(t,e)}},{key:"once",value:function(t,e){this.events.once(t,e)}},{key:"off",value:function(t,e){this.events.off(t,e)}},{key:"removeListener",value:function(t,e){this.events.removeListener(t,e)}},{key:"transportDisconnect",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)){t.next=9;break}return t.prev=1,t.next=4,Promise.all(Array.from(this.requestsInFlight.values()).map((function(t){return t.promise})));case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),this.logger.warn(t.t0);case 9:if(!this.hasExperiencedNetworkDisruption&&!this.connected){t.next=14;break}return t.next=12,Object(h.h)(this.provider.disconnect(),2e3,"provider.disconnect()").catch((function(){return e.onProviderDisconnect()}));case 12:t.next=15;break;case 14:this.onProviderDisconnect();case 15:case"end":return t.stop()}}),t,this,[[1,6]])})))}},{key:"transportClose",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.transportExplicitlyClosed=!0,t.next=3,this.transportDisconnect();case 3:case"end":return t.stop()}}),t,this)})))}},{key:"transportOpen",value:function(t){return W(this,null,T().mark((function e(){var n,r=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.confirmOnlineStateOrThrow();case 2:if(e.t0=t&&t!==this.relayUrl,!e.t0){e.next=9;break}return this.relayUrl=t,e.next=7,this.transportDisconnect();case 7:return e.next=9,this.createProvider();case 9:return this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1,e.prev=11,e.next=14,new Promise((function(t,e){return W(r,null,T().mark((function n(){var r,i=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function t(){i.provider.off(Ee,t),e(new Error("Connection interrupted while trying to subscribe"))},this.provider.on(Ee,r),n.next=4,Object(h.h)(this.provider.connect(),Object(f.toMiliseconds)(f.ONE_MINUTE),"Socket stalled when trying to connect to ".concat(this.relayUrl)).catch((function(t){e(t)}));case 4:return n.next=6,this.subscriber.start();case 6:this.hasExperiencedNetworkDisruption=!1,t();case 8:case"end":return n.stop()}}),n,this)})))}));case 14:e.next=22;break;case 16:if(e.prev=16,e.t1=e.catch(11),this.logger.error(e.t1),n=e.t1,this.isConnectionStalled(n.message)){e.next=22;break}throw e.t1;case 22:return e.prev=22,this.connectionAttemptInProgress=!1,e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[11,16,22,25]])})))}},{key:"restartTransport",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.connectionAttemptInProgress,e.t0){e.next=11;break}return this.relayUrl=t||this.relayUrl,e.next=5,this.confirmOnlineStateOrThrow();case 5:return e.next=7,this.transportClose();case 7:return e.next=9,this.createProvider();case 9:return e.next=11,this.transportOpen();case 11:case"end":return e.stop()}}),e,this)})))}},{key:"confirmOnlineStateOrThrow",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(h.O)();case 2:if(t.sent){t.next=4;break}throw new Error("No internet connection detected. Please restart your network and try again.");case 4:case"end":return t.stop()}}),t)})))}},{key:"startPingTimeout",value:function(){var t,e,n,r,i,o=this;if(Object(h.N)())try{null!=(e=null==(t=this.provider)?void 0:t.connection)&&e.socket&&(null==(i=null==(r=null==(n=this.provider)?void 0:n.connection)?void 0:r.socket)||i.once("ping",(function(){o.resetPingTimeout()}))),this.resetPingTimeout()}catch(t){this.logger.warn(t)}}},{key:"isConnectionStalled",value:function(t){return this.staleConnectionErrors.some((function(e){return t.includes(e)}))}},{key:"createProvider",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.provider.connection&&this.unregisterProviderListeners(),t.next=3,this.core.crypto.signJWT(this.relayUrl);case 3:e=t.sent,this.provider=new p.a(new m.a(Object(h.q)({sdkVersion:"2.12.2",protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners();case 5:case"end":return t.stop()}}),t,this)})))}},{key:"recordMessageEvent",value:function(t){return W(this,null,T().mark((function e(){var n,r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,r=t.message,e.next=3,this.messages.set(n,r);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"shouldIgnoreMessageEvent",value:function(t){return W(this,null,T().mark((function e(){var n,r,i;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.topic,(r=t.message)&&0!==r.length){e.next=3;break}return e.abrupt("return",(this.logger.debug("Ignoring invalid/empty message: ".concat(r)),!0));case 3:return e.next=5,this.subscriber.isSubscribed(n);case 5:if(e.sent){e.next=7;break}return e.abrupt("return",(this.logger.debug("Ignoring message for non-subscribed topic ".concat(n)),!0));case 7:return i=this.messages.has(n,r),e.abrupt("return",(i&&this.logger.debug("Ignoring duplicate message: ".concat(r)),i));case 9:case"end":return e.stop()}}),e,this)})))}},{key:"onProviderPayload",value:function(t){return W(this,null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),!Object(y.isJsonRpcRequest)(t)){e.next=13;break}if(t.method.endsWith("_subscription")){e.next=3;break}return e.abrupt("return");case 3:return n=t.params,r=n.data,i=r.topic,o=r.message,a=r.publishedAt,s={topic:i,message:o,publishedAt:a},this.logger.debug("Emitting Relayer Payload"),this.logger.trace(un({type:"event",event:n.id},s)),this.events.emit(n.id,s),e.next=9,this.acknowledgePayload(t);case 9:return e.next=11,this.onMessageEvent(s);case 11:e.next=14;break;case 13:Object(y.isJsonRpcResponse)(t)&&this.events.emit(Ae.message_ack,t);case 14:case"end":return e.stop()}}),e,this)})))}},{key:"onMessageEvent",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.shouldIgnoreMessageEvent(t);case 2:if(e.t0=e.sent,e.t0){e.next=7;break}return this.events.emit(Ae.message,t),e.next=7,this.recordMessageEvent(t);case 7:case"end":return e.stop()}}),e,this)})))}},{key:"acknowledgePayload",value:function(t){return W(this,null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(y.formatJsonRpcResult)(t.id,!0),e.next=3,this.provider.connection.send(n);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"unregisterProviderListeners",value:function(){this.provider.off(Ne,this.onPayloadHandler),this.provider.off(Ie,this.onConnectHandler),this.provider.off(Ee,this.onDisconnectHandler),this.provider.off(xe,this.onProviderErrorHandler)}},{key:"registerEventListeners",value:function(){return W(this,null,T().mark((function t(){var e,n=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(h.O)();case 2:e=t.sent,Object(h.ub)((function(t){return W(n,null,T().mark((function n(){var r=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.t0=e!==t,!n.t0){n.next=12;break}if(e=t,!t){n.next=8;break}return n.next=6,this.restartTransport().catch((function(t){return r.logger.error(t)}));case 6:n.next=12;break;case 8:return this.hasExperiencedNetworkDisruption=!0,n.next=11,this.transportDisconnect();case 11:this.transportExplicitlyClosed=!1;case 12:case"end":return n.stop()}}),n,this)})))}));case 4:case"end":return t.stop()}}),t)})))}},{key:"onProviderDisconnect",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.subscriber.stop();case 2:this.events.emit(Ae.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout((function(){return W(e,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.transportOpen().catch((function(t){return e.logger.error(t)}));case 2:case"end":return t.stop()}}),t,this)})))}),Object(f.toMiliseconds)(ke));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}},{key:"toEstablishConnection",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.confirmOnlineStateOrThrow();case 2:if(t.t0=!this.connected,!t.t0){t.next=10;break}if(t.t1=this.connectionAttemptInProgress,!t.t1){t.next=8;break}return t.next=8,new Promise((function(t){var n=setInterval((function(){e.connected&&(clearInterval(n),t())}),e.connectionStatusPollingInterval)}));case 8:return t.next=10,this.transportOpen();case 10:case"end":return t.stop()}}),t,this)})))}}])}(u.h),ln=Object.defineProperty,hn=Object.getOwnPropertySymbols,dn=Object.prototype.hasOwnProperty,fn=Object.prototype.propertyIsEnumerable,pn=function(t,e,n){return e in t?ln(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},yn=function(t,e){for(var n in e||(e={}))dn.call(e,n)&&pn(t,n,e[n]);if(hn){var r,i=O(hn(e));try{for(i.s();!(r=i.n()).done;)n=r.value,fn.call(e,n)&&pn(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},mn=function(t){function e(t,n,r){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:pe,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;return S(this,e),(i=A(this,e,[t,n,r,o])).core=t,i.logger=n,i.name=r,i.map=new Map,i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=pe,i.recentlyDeleted=[],i.recentlyDeletedLimit=200,i.init=function(){return W(N(i),null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=8;break}return this.logger.trace("Initialized"),t.next=5,this.restore();case 5:this.cached.forEach((function(t){e.getKey&&null!==t&&!Object(h.U)(t)?e.map.set(e.getKey(t),t):Object(h.P)(t)?e.map.set(t.id,t):Object(h.S)(t)&&e.map.set(t.topic,t)})),this.cached=[],this.initialized=!0;case 8:case"end":return t.stop()}}),t,this)})))},i.set=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),!this.map.has(t)){n.next=6;break}return n.next=4,this.update(t,e);case 4:n.next=11;break;case 6:return this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:t,value:e}),this.map.set(t,e),n.next=11,this.persist();case 11:case"end":return n.stop()}}),n,this)})))},i.get=function(t){return i.isInitialized(),i.logger.debug("Getting value"),i.logger.trace({type:"method",method:"get",key:t}),i.getData(t)},i.getAll=function(t){return i.isInitialized(),t?i.values.filter((function(e){return Object.keys(t).every((function(n){return v()(e[n],t[n])}))})):i.values},i.update=function(t,e){return W(N(i),null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:t,update:e}),r=yn(yn({},this.getData(t)),e),this.map.set(t,r),n.next=5,this.persist();case 5:case"end":return n.stop()}}),n,this)})))},i.delete=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),n.t0=this.map.has(t),!n.t0){n.next=9;break}return this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:t,reason:e}),this.map.delete(t),this.addToRecentlyDeleted(t),n.next=9,this.persist();case 9:case"end":return n.stop()}}),n,this)})))},i.logger=Object(s.a)(n,i.name),i.storagePrefix=o,i.getKey=a,i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.map.size}},{key:"keys",get:function(){return Array.from(this.map.keys())}},{key:"values",get:function(){return Array.from(this.map.values())}},{key:"addToRecentlyDeleted",value:function(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}},{key:"setDataStore",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getDataStore",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getData",value:function(t){var e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){var n=Object(h.A)("MISSING_OR_INVALID","Record was recently deleted - ".concat(this.name,": ").concat(t)).message;throw this.logger.error(n),new Error(n)}var r=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw this.logger.error(r),new Error(r)}return e}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setDataStore(this.values);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getDataStore();case 3:if(!(k(e=t.sent)>"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.map.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored value for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",value:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore value for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.j),gn=C((function t(e,n){var r=this;S(this,t),this.core=e,this.logger=n,this.name="pairing",this.version="0.3",this.events=new i.a,this.initialized=!1,this.storagePrefix=pe,this.ignoredPayloadTypes=[h.c],this.registeredMethods=[],this.init=function(){return W(r,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=10;break}return t.next=4,this.pairings.init();case 4:return t.next=6,this.cleanup();case 6:this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized");case 10:case"end":return t.stop()}}),t,this)})))},this.register=function(t){var e=t.methods;r.isInitialized(),r.registeredMethods=M(new Set([].concat(M(r.registeredMethods),M(e))))},this.create=function(t){return W(r,null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),n=Object(h.u)(),e.next=4,this.core.crypto.setSymKey(n);case 4:return r=e.sent,i=Object(h.e)(f.FIVE_MINUTES),a={topic:r,expiry:i,relay:o={protocol:we},active:!1},s=Object(h.s)({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:n,relay:o,expiryTimestamp:i,methods:null==t?void 0:t.methods}),e.next=11,this.pairings.set(r,a);case 11:return e.next=13,this.core.relayer.subscribe(r);case 13:return this.core.expirer.set(r,i),e.abrupt("return",{topic:r,uri:s});case 15:case"end":return e.stop()}}),e,this)})))},this.pair=function(t){return W(r,null,T().mark((function e(){var n,r,i,o,a,s,u,c;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isInitialized(),this.isValidPair(t),n=Object(h.tb)(t.uri),r=n.topic,i=n.symKey,o=n.relay,a=n.expiryTimestamp,s=n.methods,!this.pairings.keys.includes(r)||!this.pairings.get(r).active){e.next=4;break}throw new Error("Pairing already exists: ".concat(r,". Please try again with a new connection URI."));case 4:return u=a||Object(h.e)(f.FIVE_MINUTES),c={topic:r,relay:o,expiry:u,active:!1,methods:s},e.next=7,this.pairings.set(r,c);case 7:if(this.core.expirer.set(r,u),e.t0=t.activatePairing,!e.t0){e.next=12;break}return e.next=12,this.activate({topic:r});case 12:if(this.events.emit(Ce.create,c),e.t1=this.core.crypto.keychain.has(r),e.t1){e.next=17;break}return e.next=17,this.core.crypto.setSymKey(i,r);case 17:return e.next=19,this.core.relayer.subscribe(r,{relay:o});case 19:return e.abrupt("return",c);case 20:case"end":return e.stop()}}),e,this)})))},this.activate=function(t){return W(r,[t],(function(t){var e=this,n=t.topic;return T().mark((function t(){var r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isInitialized(),r=Object(h.e)(f.THIRTY_DAYS),t.next=4,e.pairings.update(n,{active:!0,expiry:r});case 4:e.core.expirer.set(n,r);case 5:case"end":return t.stop()}}),t)}))()}))},this.ping=function(t){return W(r,null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.isValidPing(t);case 3:if(n=t.topic,!this.pairings.keys.includes(n)){e.next=15;break}return e.next=7,this.sendRequest(n,"wc_pairingPing",{});case 7:return r=e.sent,i=Object(h.f)(),o=i.done,a=i.resolve,s=i.reject,this.events.once(Object(h.n)("pairing_ping",r),(function(t){var e=t.error;e?s(e):a()})),e.next=15,o();case 15:case"end":return e.stop()}}),e,this)})))},this.updateExpiry=function(t){return W(r,[t],(function(t){var e=this,n=t.topic,r=t.expiry;return T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isInitialized(),t.next=3,e.pairings.update(n,{expiry:r});case 3:case"end":return t.stop()}}),t)}))()}))},this.updateMetadata=function(t){return W(r,[t],(function(t){var e=this,n=t.topic,r=t.metadata;return T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isInitialized(),t.next=3,e.pairings.update(n,{peerMetadata:r});case 3:case"end":return t.stop()}}),t)}))()}))},this.getPairings=function(){return r.isInitialized(),r.pairings.values},this.disconnect=function(t){return W(r,null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.isValidDisconnect(t);case 3:if(n=t.topic,e.t0=this.pairings.keys.includes(n),!e.t0){e.next=10;break}return e.next=8,this.sendRequest(n,"wc_pairingDelete",Object(h.G)("USER_DISCONNECTED"));case 8:return e.next=10,this.deletePairing(n);case 10:case"end":return e.stop()}}),e,this)})))},this.sendRequest=function(t,e,n){return W(r,null,T().mark((function r(){var i,o,a;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcRequest)(e,n),r.next=3,this.core.crypto.encode(t,i);case 3:return o=r.sent,a=je[e].req,r.abrupt("return",(this.core.history.set(t,i),this.core.relayer.publish(t,o,a),i.id));case 6:case"end":return r.stop()}}),r,this)})))},this.sendResult=function(t,e,n){return W(r,null,T().mark((function r(){var i,o,a,s;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcResult)(t,n),r.next=3,this.core.crypto.encode(e,i);case 3:return o=r.sent,r.next=6,this.core.history.get(e,t);case 6:return a=r.sent,s=je[a.request.method].res,r.next=10,this.core.relayer.publish(e,o,s);case 10:return r.next=12,this.core.history.resolve(i);case 12:case"end":return r.stop()}}),r,this)})))},this.sendError=function(t,e,n){return W(r,null,T().mark((function r(){var i,o,a,s;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcError)(t,n),r.next=3,this.core.crypto.encode(e,i);case 3:return o=r.sent,r.next=6,this.core.history.get(e,t);case 6:return a=r.sent,s=je[a.request.method]?je[a.request.method].res:je.unregistered_method.res,r.next=10,this.core.relayer.publish(e,o,s);case 10:return r.next=12,this.core.history.resolve(i);case 12:case"end":return r.stop()}}),r,this)})))},this.deletePairing=function(t,e){return W(r,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.core.relayer.unsubscribe(t);case 2:return n.next=4,Promise.all([this.pairings.delete(t,Object(h.G)("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(t),e?Promise.resolve():this.core.expirer.del(t)]);case 4:case"end":return n.stop()}}),n,this)})))},this.cleanup=function(){return W(r,null,T().mark((function t(){var e,n=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.pairings.getAll().filter((function(t){return Object(h.M)(t.expiry)})),t.next=3,Promise.all(e.map((function(t){return n.deletePairing(t.topic)})));case 3:case"end":return t.stop()}}),t,this)})))},this.onRelayEventRequest=function(t){var e=t.topic,n=t.payload;switch(n.method){case"wc_pairingPing":return r.onPairingPingRequest(e,n);case"wc_pairingDelete":return r.onPairingDeleteRequest(e,n);default:return r.onUnknownRpcMethodRequest(e,n)}},this.onRelayEventResponse=function(t){return W(r,null,T().mark((function e(){var n,r,i;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,r=t.payload,e.next=4,this.core.history.get(n,r.id);case 4:i=e.sent.request.method,e.t0=i,e.next="wc_pairingPing"===e.t0?8:9;break;case 8:return e.abrupt("return",this.onPairingPingResponse(n,r));case 9:return e.abrupt("return",this.onUnknownRpcMethodResponse(i));case 10:case"end":return e.stop()}}),e,this)})))},this.onPairingPingRequest=function(t,e){return W(r,null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.id,n.prev=1,this.isValidPing({topic:t}),n.next=5,this.sendResult(r,t,!0);case 5:this.events.emit(Ce.ping,{id:r,topic:t}),n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(1),n.next=12,this.sendError(r,t,n.t0);case 12:this.logger.error(n.t0);case 13:case"end":return n.stop()}}),n,this,[[1,8]])})))},this.onPairingPingResponse=function(t,e){var n=e.id;setTimeout((function(){Object(y.isJsonRpcResult)(e)?r.events.emit(Object(h.n)("pairing_ping",n),{}):Object(y.isJsonRpcError)(e)&&r.events.emit(Object(h.n)("pairing_ping",n),{error:e.error})}),500)},this.onPairingDeleteRequest=function(t,e){return W(r,null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.id,n.prev=1,this.isValidDisconnect({topic:t}),n.next=5,this.deletePairing(t);case 5:this.events.emit(Ce.delete,{id:r,topic:t}),n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(1),n.next=12,this.sendError(r,t,n.t0);case 12:this.logger.error(n.t0);case 13:case"end":return n.stop()}}),n,this,[[1,8]])})))},this.onUnknownRpcMethodRequest=function(t,e){return W(r,null,T().mark((function n(){var r,i,o;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=e.id,i=e.method,n.prev=1,!this.registeredMethods.includes(i)){n.next=4;break}return n.abrupt("return");case 4:return o=Object(h.G)("WC_METHOD_UNSUPPORTED",i),n.next=7,this.sendError(r,t,o);case 7:this.logger.error(o),n.next=15;break;case 10:return n.prev=10,n.t0=n.catch(1),n.next=14,this.sendError(r,t,n.t0);case 14:this.logger.error(n.t0);case 15:case"end":return n.stop()}}),n,this,[[1,10]])})))},this.onUnknownRpcMethodResponse=function(t){r.registeredMethods.includes(t)||r.logger.error(Object(h.G)("WC_METHOD_UNSUPPORTED",t))},this.isValidPair=function(t){var e;if(!Object(h.fb)(t)){var n=Object(h.A)("MISSING_OR_INVALID","pair() params: ".concat(t)).message;throw new Error(n)}if(!Object(h.nb)(t.uri)){var r=Object(h.A)("MISSING_OR_INVALID","pair() uri: ".concat(t.uri)).message;throw new Error(r)}var i=Object(h.tb)(t.uri);if(null==(e=null==i?void 0:i.relay)||!e.protocol){var o=Object(h.A)("MISSING_OR_INVALID","pair() uri#relay-protocol").message;throw new Error(o)}if(null==i||!i.symKey){var a=Object(h.A)("MISSING_OR_INVALID","pair() uri#symKey").message;throw new Error(a)}if(null!=i&&i.expiryTimestamp&&Object(f.toMiliseconds)(null==i?void 0:i.expiryTimestamp)"u"&&(n.response=Object(y.isJsonRpcError)(t)?{error:t.error}:{result:t.result},this.records.set(n.id,n),this.persist(),this.events.emit(Oe,n));case 6:case"end":return e.stop()}}),e,this)})))},i.get=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:t,id:e}),n.next=5,this.getRecord(e);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n,this)})))},i.delete=function(t,e){i.isInitialized(),i.logger.debug("Deleting record"),i.logger.trace({type:"method",method:"delete",id:e}),i.values.forEach((function(n){if(n.topic===t){if(k(e)<"u"&&n.id!==e)return;i.records.delete(n.id),i.events.emit(ze,n)}})),i.persist()},i.exists=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),!this.records.has(e)){n.next=9;break}return n.next=4,this.getRecord(e);case 4:n.t1=n.sent.topic,n.t2=t,n.t0=n.t1===n.t2,n.next=10;break;case 9:n.t0=!1;case 10:return n.abrupt("return",n.t0);case 11:case"end":return n.stop()}}),n,this)})))},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.logger=Object(s.a)(n,i.name),i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"size",get:function(){return this.records.size}},{key:"keys",get:function(){return Array.from(this.records.keys())}},{key:"values",get:function(){return Array.from(this.records.values())}},{key:"pending",get:function(){var t=[];return this.values.forEach((function(e){if(!(k(e.response)<"u")){var n={topic:e.topic,request:Object(y.formatJsonRpcRequest)(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(n)}})),t}},{key:"setJsonRpcRecords",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getJsonRpcRecords",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getRecord",value:function(t){this.isInitialized();var e=this.records.get(t);if(!e){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw new Error(n)}return e}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setJsonRpcRecords(this.values);case 2:this.events.emit("history_sync");case 3:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getJsonRpcRecords();case 3:if(!(k(e=t.sent)>"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.records.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",records:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"registerEventListeners",value:function(){var t=this;this.events.on(De,(function(e){var n=De;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,record:e})})),this.events.on(Oe,(function(e){var n=Oe;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,record:e})})),this.events.on(ze,(function(e){var n=ze;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,record:e})})),this.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){t.cleanup()}))}},{key:"cleanup",value:function(){var t=this;try{this.isInitialized();var e=!1;this.records.forEach((function(n){Object(f.toMiliseconds)(n.expiry||0)-Date.now()<=0&&(t.logger.info("Deleting expired history log: ".concat(n.id)),t.records.delete(n.id),t.events.emit(ze,n,!1),e=!0)})),e&&this.persist()}catch(e){this.logger.warn(e)}}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.e),wn=function(t){function e(t,n){var i;return S(this,e),(i=A(this,e,[t,n])).core=t,i.logger=n,i.expirations=new Map,i.events=new r.EventEmitter,i.name="expirer",i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=pe,i.init=function(){return W(N(i),null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=9;break}return this.logger.trace("Initialized"),t.next=5,this.restore();case 5:this.cached.forEach((function(t){return e.expirations.set(t.target,t)})),this.cached=[],this.registerEventListeners(),this.initialized=!0;case 9:case"end":return t.stop()}}),t,this)})))},i.has=function(t){try{var e=i.formatTarget(t);return k(i.getExpiration(e))<"u"}catch(t){return!1}},i.set=function(t,e){i.isInitialized();var n=i.formatTarget(t),r={target:n,expiry:e};i.expirations.set(n,r),i.checkExpiry(n,r),i.events.emit(Pe.created,{target:n,expiration:r})},i.get=function(t){i.isInitialized();var e=i.formatTarget(t);return i.getExpiration(e)},i.del=function(t){if(i.isInitialized(),i.has(t)){var e=i.formatTarget(t),n=i.getExpiration(e);i.expirations.delete(e),i.events.emit(Pe.deleted,{target:e,expiration:n})}},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.logger=Object(s.a)(n,i.name),i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.expirations.size}},{key:"keys",get:function(){return Array.from(this.expirations.keys())}},{key:"values",get:function(){return Array.from(this.expirations.values())}},{key:"formatTarget",value:function(t){if("string"==typeof t)return Object(h.r)(t);if("number"==typeof t)return Object(h.o)(t);var e=Object(h.A)("UNKNOWN_TYPE","Target type: ".concat(k(t))).message;throw new Error(e)}},{key:"setExpirations",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getExpirations",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setExpirations(this.values);case 2:this.events.emit(Pe.sync);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getExpirations();case 3:if(!(k(e=t.sent)>"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.expirations.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored expirations for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",expirations:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore expirations for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"getExpiration",value:function(t){var e=this.expirations.get(t);if(!e){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw this.logger.warn(n),new Error(n)}return e}},{key:"checkExpiry",value:function(t,e){var n=e.expiry;Object(f.toMiliseconds)(n)-Date.now()<=0&&this.expire(t,e)}},{key:"expire",value:function(t,e){this.expirations.delete(t),this.events.emit(Pe.expired,{target:t,expiration:e})}},{key:"checkExpirations",value:function(){var t=this;this.core.relayer.connected&&this.expirations.forEach((function(e,n){return t.checkExpiry(n,e)}))}},{key:"registerEventListeners",value:function(){var t=this;this.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){return t.checkExpirations()})),this.events.on(Pe.created,(function(e){var n=Pe.created;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,data:e}),t.persist()})),this.events.on(Pe.expired,(function(e){var n=Pe.expired;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,data:e}),t.persist()})),this.events.on(Pe.deleted,(function(e){var n=Pe.deleted;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,data:e}),t.persist()}))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.d),bn=function(e){function n(e,r){var i;return S(this,n),(i=A(this,n,[e,r])).projectId=e,i.logger=r,i.name=_e,i.initialized=!1,i.queue=[],i.verifyDisabled=!1,i.init=function(t){return W(N(i),null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.verifyDisabled&&!Object(h.Q)()&&Object(h.K)()){e.next=2;break}return e.abrupt("return");case 2:return n=this.getVerifyUrl(null==t?void 0:t.verifyUrl),this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n,e.prev=4,e.next=7,this.createIframe();case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(4),this.logger.info("Verify iframe failed to load: ".concat(this.verifyUrl)),this.logger.info(e.t0);case 12:if(this.initialized){e.next=22;break}return this.removeIframe(),this.verifyUrl=Re,e.prev=14,e.next=17,this.createIframe();case 17:e.next=22;break;case 19:e.prev=19,e.t1=e.catch(14),this.logger.info("Verify iframe failed to load: ".concat(this.verifyUrl)),this.logger.info(e.t1),this.verifyDisabled=!0;case 22:case"end":return e.stop()}}),e,this,[[4,9],[14,19]])})))},i.register=function(t){return W(N(i),null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.initialized){e.next=4;break}this.sendPost(t.attestationId),e.next=7;break;case 4:return this.addToQueue(t.attestationId),e.next=7,this.init();case 7:case"end":return e.stop()}}),e,this)})))},i.resolve=function(t){return W(N(i),null,T().mark((function e(){var n,r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isDevEnv){e.next=2;break}return e.abrupt("return","");case 2:return n=this.getVerifyUrl(null==t?void 0:t.verifyUrl),e.prev=3,e.next=6,this.fetchAttestation(t.attestationId,n);case 6:r=e.sent,e.next=16;break;case 9:return e.prev=9,e.t0=e.catch(3),this.logger.info("failed to resolve attestation: ".concat(t.attestationId," from url: ").concat(n)),this.logger.info(e.t0),e.next=15,this.fetchAttestation(t.attestationId,Re);case 15:r=e.sent;case 16:return e.abrupt("return",r);case 17:case"end":return e.stop()}}),e,this,[[3,9]])})))},i.fetchAttestation=function(t,e){return W(N(i),null,T().mark((function n(){var r,i;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.logger.info("resolving attestation: ".concat(t," from url: ").concat(e)),r=this.startAbortTimer(2*f.ONE_SECOND),n.next=4,fetch("".concat(e,"/attestation/").concat(t),{signal:this.abortController.signal});case 4:if(i=n.sent,clearTimeout(r),200!==i.status){n.next=12;break}return n.next=9,i.json();case 9:n.t0=n.sent,n.next=13;break;case 12:n.t0=void 0;case 13:return n.abrupt("return",n.t0);case 14:case"end":return n.stop()}}),n,this)})))},i.addToQueue=function(t){i.queue.push(t)},i.processQueue=function(){0!==i.queue.length&&(i.queue.forEach((function(t){return i.sendPost(t)})),i.queue=[])},i.sendPost=function(t){var e;try{if(!i.iframe)return;null==(e=i.iframe.contentWindow)||e.postMessage(t,"*"),i.logger.info("postMessage sent: ".concat(t," ").concat(i.verifyUrl))}catch(t){}},i.createIframe=function(){return W(N(i),null,T().mark((function t(){var e,n,r=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=function t(n){"verify_ready"===n.data&&(r.onInit(),window.removeEventListener("message",t),e())},t.next=3,Promise.race([new Promise((function(t){var i=document.getElementById(_e);if(i)return r.iframe=i,r.onInit(),t();window.addEventListener("message",n);var o=document.createElement("iframe");o.id=_e,o.src="".concat(r.verifyUrl,"/").concat(r.projectId),o.style.display="none",document.body.append(o),r.iframe=o,e=t})),new Promise((function(t,e){return setTimeout((function(){window.removeEventListener("message",n),e("verify iframe load timeout")}),Object(f.toMiliseconds)(f.FIVE_SECONDS))}))]);case 3:case"end":return t.stop()}}),t)})))},i.onInit=function(){i.initialized=!0,i.processQueue()},i.removeIframe=function(){i.iframe&&(i.iframe.remove(),i.iframe=void 0,i.initialized=!1)},i.getVerifyUrl=function(t){var e=t||Be;return Ue.includes(e)||(i.logger.info("verify url: ".concat(e,", not included in trusted list, assigning default: ").concat(Be)),e=Be),e},i.logger=Object(s.a)(r,i.name),i.verifyUrl=Be,i.abortController=new AbortController,i.isDevEnv=Object(h.N)()&&t.env.IS_VITEST,i}return E(n,e),C(n,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"startAbortTimer",value:function(t){var e=this;return this.abortController=new AbortController,setTimeout((function(){return e.abortController.abort()}),Object(f.toMiliseconds)(t))}}])}(u.l),Mn=function(t){function e(t,n){var r;return S(this,e),(r=A(this,e,[t,n])).projectId=t,r.logger=n,r.context="echo",r.registerDeviceToken=function(t){return W(N(r),null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.clientId,r=t.token,i=t.notificationType,o=t.enableEncrypted,a=void 0!==o&&o,s="".concat("https://echo.walletconnect.com","/").concat(this.projectId,"/clients"),e.next=3,b()(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:i,token:r,always_raw:a})});case 3:case"end":return e.stop()}}),e,this)})))},r.logger=Object(s.a)(n,r.context),r}return E(e,t),C(e)}(u.b),An=Object.defineProperty,Nn=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable,xn=function(t,e,n){return e in t?An(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},kn=function(t,e){for(var n in e||(e={}))In.call(e,n)&&xn(t,n,e[n]);if(Nn){var r,i=O(Nn(e));try{for(i.s();!(r=i.n()).done;)n=r.value,En.call(e,n)&&xn(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},Tn=function(t){function e(t){var n,i;S(this,e),(n=A(this,e,[t])).protocol="wc",n.version=2,n.name=fe,n.events=new r.EventEmitter,n.initialized=!1,n.on=function(t,e){return n.events.on(t,e)},n.once=function(t,e){return n.events.once(t,e)},n.off=function(t,e){return n.events.off(t,e)},n.removeListener=function(t,e){return n.events.removeListener(t,e)},n.projectId=null==t?void 0:t.projectId,n.relayUrl=(null==t?void 0:t.relayUrl)||be,n.customStoragePrefix=null!=t&&t.customStoragePrefix?":".concat(t.customStoragePrefix):"";var u=Object(s.c)({level:"string"==typeof(null==t?void 0:t.logger)&&t.logger?t.logger:"error"}),c=Object(s.b)({opts:u,maxSizeInBytes:null==t?void 0:t.maxLogBlobSizeInBytes,loggerOverride:null==t?void 0:t.logger}),l=c.logger,h=c.chunkLoggerController;return n.logChunkController=h,null!=(i=n.logChunkController)&&i.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=function(){return W(n,null,T().mark((function t(){var e,n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser,!t.t0){t.next=10;break}if(t.t1=null==(n=this.logChunkController),t.t1){t.next=10;break}return t.t2=n,t.next=7,this.crypto.getClientId();case 7:t.t3=t.sent,t.t4={clientId:t.t3},t.t2.downloadLogsBlobInBrowser.call(t.t2,t.t4);case 10:case"end":return t.stop()}}),t,this)})))}),n.logger=Object(s.a)(l,n.name),n.heartbeat=new a.HeartBeat,n.crypto=new Ye(n,n.logger,null==t?void 0:t.keychain),n.history=new vn(n,n.logger),n.expirer=new wn(n,n.logger),n.storage=null!=t&&t.storage?t.storage:new o.a(kn(kn({},ye),null==t?void 0:t.storageOptions)),n.relayer=new cn({core:n,logger:n.logger,relayUrl:n.relayUrl,projectId:n.projectId}),n.pairing=new gn(n,n.logger),n.verify=new bn(n.projectId||"",n.logger),n.echoClient=new Mn(n.projectId||"",n.logger),n}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"start",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=4;break}return t.next=4,this.initialize();case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getLogsBlob",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=(e=this.logChunkController)){t.next=4;break}t.t0=void 0,t.next=10;break;case 4:return t.t1=e,t.next=7,this.crypto.getClientId();case 7:t.t2=t.sent,t.t3={clientId:t.t2},t.t0=t.t1.logsToBlob.call(t.t1,t.t3);case 10:return t.abrupt("return",t.t0);case 11:case"end":return t.stop()}}),t,this)})))}},{key:"initialize",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.logger.trace("Initialized"),t.prev=1,t.next=4,this.crypto.init();case 4:return t.next=6,this.history.init();case 6:return t.next=8,this.expirer.init();case 8:return t.next=10,this.relayer.init();case 10:return t.next=12,this.heartbeat.init();case 12:return t.next=14,this.pairing.init();case 14:this.initialized=!0,this.logger.info("Core Initialization Success"),t.next=21;break;case 18:throw t.prev=18,t.t0=t.catch(1),this.logger.warn("Core Initialization Failure at epoch ".concat(Date.now()),t.t0),this.logger.error(t.t0.message),t.t0;case 21:case"end":return t.stop()}}),t,this,[[1,18]])})))}}],[{key:"init",value:function(t){return W(this,null,T().mark((function n(){var r,i;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=new e(t),n.next=3,r.initialize();case 3:return n.next=5,r.crypto.getClientId();case 5:return i=n.sent,n.next=8,r.storage.setItem("WALLETCONNECT_CLIENT_ID",i);case 8:return n.abrupt("return",r);case 9:case"end":return n.stop()}}),n)})))}}])}(u.a)}).call(this,n(33))},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string";if(!t[e]||r(t[e])!==n)throw new Error('Missing or invalid "'.concat(e,'" param'))}function o(t,e,n){return!!(n.length?function(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}(t,e.length):function(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}(t,e.length))&&function(t,e){var n=!0;return e.forEach((function(e){e in t||(n=!1)})),n}(t,e)}function a(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_",r=t.split(n);return r[r.length-1].trim().toLowerCase()===e.trim().toLowerCase()}n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return a}))},function(t,e,n){n.d(e,"a",(function(){return y})),n.d(e,"b",(function(){return I})),n.d(e,"c",(function(){return x})),n.d(e,"d",(function(){return A})),n.d(e,"e",(function(){return m})),n.d(e,"f",(function(){return g})),n.d(e,"g",(function(){return v})),n.d(e,"h",(function(){return w})),n.d(e,"i",(function(){return E})),n.d(e,"j",(function(){return b})),n.d(e,"k",(function(){return M})),n.d(e,"l",(function(){return N}));var r=n(22),i=n(6),o=n.n(i);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var n=0;ne in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,u=(t,e)=>{for(var n in e||(e={}))o.call(e,n)&&s(t,n,e[n]);if(i)for(var n of i(e))a.call(e,n)&&s(t,n,e[n]);return t};Object.defineProperty(e,"__esModule",{value:!0});var c=n(95),l=n(18);class h{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class d{constructor(t,e,n){if(this.name=t,this.prefix=e,void 0===e.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if("string"==typeof t){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(t){return p(this,t)}}class f{constructor(t){this.decoders=t}or(t){return p(this,t)}decode(t){const e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const p=(t,e)=>new f(u(u({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class y{constructor(t,e,n,r){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=r,this.encoder=new h(t,e,n),this.decoder=new d(t,e,r)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const m=({name:t,prefix:e,encode:n,decode:r})=>new y(t,e,n,r);e.Codec=y,e.baseX=({prefix:t,name:e,alphabet:n})=>{const{encode:r,decode:i}=c(n,e);return m({prefix:t,name:e,encode:r,decode:t=>l.coerce(i(t))})},e.from=m,e.or=p,e.rfc4648=({name:t,prefix:e,bitsPerChar:n,alphabet:r})=>m({prefix:e,name:t,encode:t=>((t,e,n)=>{const r="="===e[e.length-1],i=(1<n;)a-=n,o+=e[i&s>>a];if(a&&(o+=e[i&s<((t,e,n,r)=>{const i={};for(let t=0;t=8&&(s-=8,a[c++]=255&u>>s)}if(s>=n||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a})(e,r,n,t)})},function(t,e,n){const r=n(86);t.exports=a;const i=function(){function t(t){return void 0!==t&&t}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e){return t(self)||t(window)||t(this)||{}}}().console||{},o={mapHttpRequest:p,mapHttpResponse:p,wrapRequestSerializer:y,wrapResponseSerializer:y,wrapErrorSerializer:y,req:p,res:p,err:function(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)void 0===e[n]&&(e[n]=t[n]);return e}};function a(t){(t=t||{}).browser=t.browser||{};const e=t.browser.transmit;if(e&&"function"!=typeof e.send)throw Error("pino: transmit option must have a send function");const n=t.browser.write||i;t.browser.write&&(t.browser.asObject=!0);const r=t.serializers||{},o=function(t,e){return Array.isArray(t)?t.filter((function(t){return"!stdSerializers.err"!==t})):!0===t&&Object.keys(e)}(t.browser.serialize,r);let u=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(u=!1),"function"==typeof n&&(n.error=n.fatal=n.warn=n.info=n.debug=n.trace=n),!1===t.enabled&&(t.level="silent");const h=t.level||"info",p=Object.create(n);p.log||(p.log=m),Object.defineProperty(p,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(p,"level",{get:function(){return this._level},set:function(t){if("silent"!==t&&!this.levels.values[t])throw Error("unknown level "+t);this._level=t,s(y,p,"error","log"),s(y,p,"fatal","error"),s(y,p,"warn","error"),s(y,p,"info","log"),s(y,p,"debug","log"),s(y,p,"trace","log")}});const y={transmit:e,serialize:o,asObject:t.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:f(t)};return p.levels=a.levels,p.level=h,p.setMaxListeners=p.getMaxListeners=p.emit=p.addListener=p.on=p.prependListener=p.once=p.prependOnceListener=p.removeListener=p.removeAllListeners=p.listeners=p.listenerCount=p.eventNames=p.write=p.flush=m,p.serializers=r,p._serialize=o,p._stdErrSerialize=u,p.child=function(n,i){if(!n)throw new Error("missing bindings for child Pino");i=i||{},o&&n.serializers&&(i.serializers=n.serializers);const a=i.serializers;if(o&&a){var s=Object.assign({},r,a),u=!0===t.browser.serialize?Object.keys(s):o;delete n.serializers,c([n],u,s,this._stdErrSerialize)}function h(t){this._childLevel=1+(0|t._childLevel),this.error=l(t,n,"error"),this.fatal=l(t,n,"fatal"),this.warn=l(t,n,"warn"),this.info=l(t,n,"info"),this.debug=l(t,n,"debug"),this.trace=l(t,n,"trace"),s&&(this.serializers=s,this._serialize=u),e&&(this._logEvent=d([].concat(t._logEvent.bindings,n)))}return h.prototype=this,new h(this)},e&&(p._logEvent=d()),p}function s(t,e,n,r){const o=Object.getPrototypeOf(e);e[n]=e.levelVal>e.levels.values[n]?m:o[n]?o[n]:i[n]||i[r]||m,function(t,e,n){var r;(t.transmit||e[n]!==m)&&(e[n]=(r=e[n],function(){const o=t.timestamp(),s=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var d=0;d-1&&r in n&&(t[i][r]=n[r](t[i][r]))}function l(t,e,n){return function(){const r=new Array(1+arguments.length);r[0]=e;for(var i=1;i=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(ma)),ma.exports}var ba,Ma={exports:{}};var Aa,Na={exports:{}};function Ia(){return Aa||(Aa=1,function(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports}(Na)),Na.exports}var Ea,xa={exports:{}};function ka(){return Ea||(Ea=1,function(t){function e(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;(0,o.default)(this,p);var a=r.autoconnect,s=void 0===a||a,u=r.reconnect,c=void 0===u||u,l=r.reconnect_interval,h=void 0===l?1e3:l,y=r.max_reconnects,m=void 0===y?5:y,g=d(r,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return(e=f.call(this)).webSocketFactory=t,e.queue={},e.rpc_id=0,e.address=n,e.autoconnect=s,e.ready=!1,e.reconnect=c,e.reconnect_timer_id=void 0,e.reconnect_interval=h,e.max_reconnects=m,e.rest_options=g,e.current_reconnects=0,e.generate_request_id=i||function(){return++e.rpc_id},e.autoconnect&&e._connect(e.address,Object.assign({autoconnect:e.autoconnect,reconnect:e.reconnect,reconnect_interval:e.reconnect_interval,max_reconnects:e.max_reconnects},e.rest_options)),e}return(0,a.default)(p,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(t,e,n,r){var o=this;return r||"object"!==(0,i.default)(n)||(r=n,n=null),new Promise((function(i,a){if(!o.ready)return a(new Error("socket not ready"));var s=o.generate_request_id(t,e),u={jsonrpc:"2.0",method:t,params:e||null,id:s};o.socket.send(JSON.stringify(u),r,(function(t){if(t)return a(t);o.queue[s]={promise:[i,a]},n&&(o.queue[s].timeout=setTimeout((function(){delete o.queue[s],a(new Error("reply timeout"))}),n))}))}))}},{key:"login",value:(l=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("rpc.login",e);case 2:if(r=t.sent){t.next=5;break}throw new Error("authentication failed");case 5:return t.abrupt("return",r);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return l.apply(this,arguments)})},{key:"listMethods",value:(c=(0,r.default)(n.default.mark((function t(){return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("__listMethods");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"notify",value:function(t,e){var n=this;return new Promise((function(r,i){if(!n.ready)return i(new Error("socket not ready"));var o={jsonrpc:"2.0",method:t,params:e||null};n.socket.send(JSON.stringify(o),(function(t){if(t)return i(t);r()}))}))}},{key:"subscribe",value:(u=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.on",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed subscribing to an event '"+e+"' with: "+r[e]);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"unsubscribe",value:(e=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.off",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed unsubscribing from an event with: "+r);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"close",value:function(t,e){this.socket.close(t||1e3,e)}},{key:"_connect",value:function(t,e){var n=this;clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",(function(){n.ready=!0,n.emit("open"),n.current_reconnects=0})),this.socket.addEventListener("message",(function(t){var e=t.data;e instanceof ArrayBuffer&&(e=It.from(e).toString());try{e=JSON.parse(e)}catch(t){return}if(e.notification&&n.listeners(e.notification).length){if(!Object.keys(e.params).length)return n.emit(e.notification);var r=[e.notification];if(e.params.constructor===Object)r.push(e.params);else for(var i=0;in.current_reconnects||0===n.max_reconnects)&&(n.reconnect_timer_id=setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval)))}))}}]),p}(l.EventEmitter);t.default=f}(la);var Ha=S(la),Ga={};!function(t){var e=ha.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t,e){return new u(t,e)};var n=e(Ia()),r=e(ka()),i=e(Da()),o=e(Ra()),a=e(Ya());function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,a.default)(t);if(e){var i=(0,a.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,o.default)(this,n)}}var u=function(t){(0,i.default)(o,t);var e=s(o);function o(t,r,i){var a;return(0,n.default)(this,o),(a=e.call(this)).socket=new window.WebSocket(t,i),a.socket.onopen=function(){return a.emit("open")},a.socket.onmessage=function(t){return a.emit("message",t.data)},a.socket.onerror=function(t){return a.emit("error",t)},a.socket.onclose=function(t){a.emit("close",t.code,t.reason)},a}return(0,r.default)(o,[{key:"send",value:function(t,e,n){var r=n||e;try{this.socket.send(t),r()}catch(t){r(t)}}},{key:"close",value:function(t,e){this.socket.close(t,e)}},{key:"addEventListener",value:function(t,e,n){this.socket.addEventListener(t,e,n)}}]),o}(Va().EventEmitter)}(Ga);for(var qa=S(Ga),Za=[],Ja=[],Xa=[],Ka=BigInt(0),$a=BigInt(1),ts=BigInt(2),es=BigInt(7),ns=BigInt(256),rs=BigInt(113),is=0,os=$a,as=1,ss=0;is<24;is++){var us=[ss,(2*as+3*ss)%5];as=us[0],ss=us[1],Za.push(2*(5*ss+as)),Ja.push((is+1)*(is+2)/2%64);for(var cs=Ka,ls=0;ls<7;ls++)(os=(os<<$a^(os>>es)*rs)%ns)&ts&&(cs^=$a<<($a<32?De(t,e,n):je(t,e,n)},ys=function(t,e,n){return n>32?Oe(t,e,n):Ce(t,e,n)};var ms=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(B(this,n),(o=e.call(this)).blockLen=t,o.suffix=r,o.outputLen=i,o.enableXOF=a,o.rounds=s,o.pos=0,o.posOut=0,o.finished=!1,o.destroyed=!1,le(i),0>=o.blockLen||o.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");return o.state=new Uint8Array(200),o.state32=me(o.state),o}return U(n,[{key:"keccak",value:function(){!function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24,n=new Uint32Array(10),r=24-e;r<24;r++){for(var i=0;i<10;i++)n[i]=t[i]^t[i+10]^t[i+20]^t[i+30]^t[i+40];for(var o=0;o<10;o+=2)for(var a=(o+8)%10,s=(o+2)%10,u=n[s],c=n[s+1],l=ps(u,c,1)^n[a],h=ys(u,c,1)^n[a+1],d=0;d<50;d+=10)t[o+d]^=l,t[o+d+1]^=h;for(var f=t[2],p=t[3],y=0;y<24;y++){var m=Ja[y],g=ps(f,p,m),v=ys(f,p,m),w=Za[y];f=t[w],p=t[w+1],t[w]=g,t[w+1]=v}for(var b=0;b<50;b+=10){for(var M=0;M<10;M++)n[M]=t[b+M];for(var A=0;A<10;A++)t[b+A]^=~n[(A+2)%10]&n[(A+4)%10]}t[0]^=ds[r],t[1]^=fs[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}},{key:"update",value:function(t){fe(this);for(var e=this.blockLen,n=this.state,r=(t=Me(t)).length,i=0;i=n&&this.keccak();var o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}},{key:"xofInto",value:function(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}},{key:"xof",value:function(t){return le(t),this.xofInto(new Uint8Array(t))}},{key:"digestInto",value:function(t){if(pe(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}},{key:"digest",value:function(){return this.digestInto(new Uint8Array(this.outputLen))}},{key:"destroy",value:function(){this.destroyed=!0,this.state.fill(0)}},{key:"_cloneInto",value:function(t){var e=this.blockLen,r=this.suffix,i=this.outputLen,o=this.rounds,a=this.enableXOF;return t||(t=new n(e,r,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}}]),n}(Ne),gs=function(t,e,n){return Ie((function(){return new ms(e,t,n)}))}(1,136,32);var vs=an,ws=on,bs={Err:function(t){Y(n,t);var e=X(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return B(this,n),e.call(this,t)}return U(n)}(G(Error)),_parseInt:function(t){var e=bs.Err;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");var n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:vs(r),l:t.subarray(n+2)}},toSig:function(t){var e=bs.Err,n="string"==typeof t?ws(t):t;if(!He(n))throw new Error("ui8a expected");var r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");var i=bs._parseInt(n.subarray(2)),o=i.d,a=i.l,s=bs._parseInt(a),u=s.d;if(s.l.length)throw new e("Invalid signature: left bytes after parsing");return{r:o,s:u}},hexFromSig:function(t){var e=function(t){return 8&Number.parseInt(t[0],16)?"00"+t:t},n=function(t){var e=t.toString(16);return 1&e.length?"0".concat(e):e},r=e(n(t.s)),i=e(n(t.r)),o=r.length/2,a=i.length/2,s=n(o),u=n(a);return"30".concat(n(a+o+4),"02").concat(u).concat(i,"02").concat(s).concat(r)}},Ms=BigInt(0),As=BigInt(1);BigInt(2);var Ns=BigInt(3);function Is(t){var e=function(t){var e=Qn(t);gn(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});var n=e.endo,r=e.Fp,i=e.a;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!==z(n)||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze(D({},e))}(t),n=e.Fp,r=e.toBytes||function(t,e,r){var i=e.toAffine();return hn(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))},i=e.fromBytes||function(t){var e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}};function o(t){var r=e.a,i=e.b,o=n.sqr(t),a=n.mul(o,t);return n.add(n.add(a,n.mul(t,r)),i)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(t){return"bigint"==typeof t&&MsMs||h>Ms;)c&As&&(d=d.add(y)),h&As&&(p=p.add(y)),y=y.double(),c>>=As,h>>=As;return u&&(d=d.negate()),l&&(p=p.negate()),p=new t(n.mul(p.px,o.beta),p.py,p.pz),d.add(p)}},{key:"multiply",value:function(r){s(r);var i,o,a=r,u=e.endo;if(u){var c=u.splitScalar(a),l=c.k1neg,h=c.k1,d=c.k2neg,p=c.k2,y=this.wNAF(h),m=y.p,g=y.f,v=this.wNAF(p),w=v.p,b=v.f;m=f.constTimeNegate(l,m),w=f.constTimeNegate(d,w),w=new t(n.mul(w.px,u.beta),w.py,w.pz),i=m.add(w),o=g.add(b)}else{var M=this.wNAF(a);i=M.p,o=M.f}return t.normalizeZ([i,o])[0]}},{key:"multiplyAndAddUnsafe",value:function(e,n,r){var i=t.BASE,o=function(t,e){return e!==Ms&&e!==As&&t.equals(i)?t.multiply(e):t.multiplyUnsafe(e)},a=o(this,n).add(o(e,r));return a.is0()?void 0:a}},{key:"toAffine",value:function(t){var e=this.px,r=this.py,i=this.pz,o=this.is0();null==t&&(t=o?n.ONE:n.inv(i));var a=n.mul(e,t),s=n.mul(r,t),u=n.mul(i,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:a,y:s}}},{key:"isTorsionFree",value:function(){var n=e.h,r=e.isTorsionFree;if(n===As)return!0;if(r)return r(t,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}},{key:"clearCofactor",value:function(){var n=e.h,r=e.clearCofactor;return n===As?this:r?r(t,this):this.multiplyUnsafe(e.h)}},{key:"toRawBytes",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.assertValidity(),r(t,this,e)}},{key:"toHex",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return qe(this.toRawBytes(t))}}],[{key:"fromAffine",value:function(e){var r=e||{},i=r.x,o=r.y;if(!e||!n.isValid(i)||!n.isValid(o))throw new Error("invalid affine point");if(e instanceof t)throw new Error("projective point not allowed");var a=function(t){return n.eql(t,n.ZERO)};return a(i)&&a(o)?t.ZERO:new t(i,o,n.ONE)}},{key:"normalizeZ",value:function(e){var r=n.invertBatch(e.map((function(t){return t.pz})));return e.map((function(t,e){return t.toAffine(r[e])})).map(t.fromAffine)}},{key:"fromHex",value:function(e){var n=t.fromAffine(i(ln("pointHex",e)));return n.assertValidity(),n}},{key:"fromPrivateKey",value:function(e){return t.BASE.multiply(u(e))}}]),t}();h.BASE=new h(e.Gx,e.Gy,n.ONE),h.ZERO=new h(n.ZERO,n.ONE,n.ZERO);var d=e.nBitLength,f=Un(h,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function Es(t){var e,n=(gn(e=Qn(t),{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze(D({lowS:!0},e))),r=n.Fp,i=n.n,o=r.BYTES+1,a=2*r.BYTES+1;function s(t){return xn(t,i)}function u(t){return Ln(t,i)}var c=Is(D(D({},n),{},{toBytes:function(t,e,n){var i=e.toAffine(),o=r.toBytes(i.x),a=hn;return n?a(Uint8Array.from([e.hasEvenY()?2:3]),o):a(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes:function(t){var e=t.length,n=t[0],i=t.subarray(1);if(e!==o||2!==n&&3!==n){if(e===a&&4===n)return{x:r.fromBytes(i.subarray(0,r.BYTES)),y:r.fromBytes(i.subarray(r.BYTES,2*r.BYTES))};throw new Error("Point of length ".concat(e," was invalid. Expected ").concat(o," compressed bytes or ").concat(a," uncompressed bytes"))}var s=an(i);if(!(Ms<(u=s)&&ui>>As}function m(t){return y(t)?s(-t):t}var g=function(t,e,n){return an(t.slice(e,n))},v=function(){function t(e,n,r){B(this,t),this.r=e,this.s=n,this.recovery=r,this.assertValidity()}return U(t,[{key:"assertValidity",value:function(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}},{key:"addRecoveryBit",value:function(e){return new t(this.r,this.s,e)}},{key:"recoverPublicKey",value:function(t){var e=this.r,i=this.s,o=this.recovery,a=A(ln("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");var c=2===o||3===o?e+n.n:e;if(c>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");var h=0==(1&o)?"02":"03",d=l.fromHex(h+p(c)),f=u(c),y=s(-a*f),m=s(i*f),g=l.BASE.multiplyAndAddUnsafe(d,y,m);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}},{key:"hasHighS",value:function(){return y(this.s)}},{key:"normalizeS",value:function(){return this.hasHighS()?new t(this.r,s(-this.s),this.recovery):this}},{key:"toDERRawBytes",value:function(){return on(this.toDERHex())}},{key:"toDERHex",value:function(){return bs.hexFromSig({r:this.r,s:this.s})}},{key:"toCompactRawBytes",value:function(){return on(this.toCompactHex())}},{key:"toCompactHex",value:function(){return p(this.r)+p(this.s)}}],[{key:"fromCompact",value:function(e){var r=n.nByteLength;return e=ln("compactSignature",e,2*r),new t(g(e,0,r),g(e,r,2*r))}},{key:"fromDER",value:function(e){var n=bs.toSig(ln("DER",e));return new t(n.r,n.s)}}]),t}(),w={isValidPrivateKey:function(t){try{return h(t),!0}catch(t){return!1}},normPrivateKeyToScalar:h,randomPrivateKey:function(){var t=_n(n.n);return function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.length,i=Pn(e),o=_n(e);if(r<16||r1024)throw new Error("expected ".concat(o,"-1024 bytes of input, got ").concat(r));var a=xn(n?an(t):sn(t),e-bn)+bn;return n?cn(a,i):un(a,i)}(n.randomBytes(t),n.n)},precompute:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.BASE;return e._setWindowSize(t),e.multiply(BigInt(3)),e}};function b(t){var e=He(t),n="string"==typeof t,r=(e||n)&&t.length;return e?r===o||r===a:n?r===2*o||r===2*a:t instanceof l}var M=n.bits2int||function(t){var e=an(t),r=8*t.length-n.nBitLength;return r>0?e>>BigInt(r):e},A=n.bits2int_modN||function(t){return s(M(t))},N=dn(n.nBitLength);function I(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(Ms<=t&&t2&&void 0!==arguments[2]?arguments[2]:x;if(["recovered","canonical"].some((function(t){return t in i})))throw new Error("sign() legacy options not supported");var o=n.hash,a=n.randomBytes,c=i.lowS,d=i.prehash,p=i.extraEntropy;null==c&&(c=!0),t=ln("msgHash",t),d&&(t=ln("prehashed msgHash",o(t)));var g=A(t),w=h(e),b=[I(w),I(g)];if(null!=p){var N=!0===p?a(r.BYTES):p;b.push(ln("extraEntropy",N))}var E=hn.apply(vn,b),k=g;function T(t){var e=M(t);if(f(e)){var n=u(e),r=l.BASE.multiply(e).toAffine(),i=s(r.x);if(i!==Ms){var o=s(n*s(k+i*w));if(o!==Ms){var a=(r.x===i?0:2)|Number(r.y&As),h=o;return c&&y(o)&&(h=m(o),a^=1),new v(i,h,a)}}}}return{seed:E,k2sig:T}}var x={lowS:n.lowS,prehash:!1},k={lowS:n.lowS,prehash:!1};return l.BASE._setWindowSize(8),{CURVE:n,getPublicKey:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return l.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(b(t))throw new Error("first arg must be private key");if(!b(e))throw new Error("second arg must be public key");var r=l.fromHex(e);return r.multiply(h(t)).toRawBytes(n)},sign:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:x,i=E(t,e,r),o=i.seed,a=i.k2sig,s=n,u=yn(s.hash.outputLen,s.nByteLength,s.hmac);return u(o,a)},verify:function(t,e,r){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:k,a=t;if(e=ln("msgHash",e),r=ln("publicKey",r),"strict"in o)throw new Error("options.strict was renamed to lowS");var c,h=o.lowS,d=o.prehash,f=void 0;try{if("string"==typeof a||He(a))try{f=v.fromDER(a)}catch(t){if(!(t instanceof bs.Err))throw t;f=v.fromCompact(a)}else{if("object"!==z(a)||"bigint"!=typeof a.r||"bigint"!=typeof a.s)throw new Error("PARSE");var p=a.r,y=a.s;f=new v(p,y)}c=l.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(h&&f.hasHighS())return!1;d&&(e=n.hash(e));var m=f,g=m.r,w=m.s,b=A(e),M=u(w),N=s(b*M),I=s(g*M),E=null===(i=l.BASE.multiplyAndAddUnsafe(c,N,I))||void 0===i?void 0:i.toAffine();if(!E)return!1;var x=s(E.x);return x===g},ProjectivePoint:l,Signature:v,utils:w}}BigInt(4);var xs=function(t){Y(n,t);var e=X(n);function n(t,r){var i;B(this,n),(i=e.call(this)).finished=!1,i.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");le(t.outputLen),le(t.blockLen)}(t);var o=Me(r);if(i.iHash=t.create(),"function"!=typeof i.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");i.blockLen=i.iHash.blockLen,i.outputLen=i.iHash.outputLen;var a=i.blockLen,s=new Uint8Array(a);s.set(o.length>a?t.create().update(o).digest():o);for(var u=0;ua,d=l>a;if(h&&(c=e-c),d&&(l=e-l),c>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:h,k1:c,k2neg:d,k2:l}}}},Os=wr,zs=function(t){return Es(D(D({},Ds),function(t){return{hash:t,hmac:function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i$s)throw new Error("Invalid public key input")}return e}return U(a,[{key:"equals",value:function(t){return this._bn.eq(t._bn)}},{key:"toBase58",value:function(){return fr.encode(this.toBytes())}},{key:"toJSON",value:function(){return this.toBase58()}},{key:"toBytes",value:function(){var t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}},{key:"toBuffer",value:function(){var t=this._bn.toArrayLike(It);if(t.length===$s)return t;var e=It.alloc(32);return t.copy(e,32-t.length),e}},{key:e,get:function(){return"PublicKey(".concat(this.toString(),")")}},{key:"toString",value:function(){return this.toBase58()}}],[{key:"unique",value:function(){var t=new a(tu);return tu+=1,new a(t.toBuffer())}},{key:"createWithSeed",value:(i=_(O().mark((function t(e,n,r){var i,o;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=It.concat([e.toBuffer(),It.from(n),r.toBuffer()]),o=wr(i),t.abrupt("return",new a(o));case 3:case"end":return t.stop()}}),t)}))),function(t,e,n){return i.apply(this,arguments)})},{key:"createProgramAddressSync",value:function(t,e){var n=It.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");n=It.concat([n,Zs(t)])})),n=It.concat([n,e.toBuffer(),It.from("ProgramDerivedAddress")]);var r=wr(n);if(Vs(r))throw new Error("Invalid seeds, address must fall off the curve");return new a(r)}},{key:"createProgramAddress",value:(r=_(O().mark((function t(e,n){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.createProgramAddressSync(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"findProgramAddressSync",value:function(t,e){for(var n,r=255;0!=r;){try{var i=t.concat(It.from([r]));n=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}},{key:"findProgramAddress",value:(n=_(O().mark((function t(e,n){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.findProgramAddressSync(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"isOnCurve",value:function(t){return Vs(new a(t).toBytes())}}]),a}(Js,Symbol.toStringTag);Hs=eu,eu.default=new Hs("11111111111111111111111111111111"),Ks.set(eu,{kind:"struct",fields:[["_bn","u256"]]});var nu=function(){function t(e){if(B(this,t),this._publicKey=void 0,this._secretKey=void 0,e){var n=Zs(e);if(64!==e.length)throw new Error("bad secret key size");this._publicKey=n.slice(32,64),this._secretKey=n.slice(0,32)}else this._secretKey=Zs(Ys()),this._publicKey=Zs(Fs(this._secretKey))}return U(t,[{key:"publicKey",get:function(){return new eu(this._publicKey)}},{key:"secretKey",get:function(){return It.concat([this._secretKey,this._publicKey],64)}}]),t}(),ru=new eu("BPFLoader1111111111111111111111111111111111"),iu=1232,ou=127,au=64,su=function(t){Y(n,t);var e=X(n);function n(t){var r;return B(this,n),(r=e.call(this,"Signature ".concat(t," has expired: block height exceeded."))).signature=void 0,r.signature=t,r}return U(n)}(G(Error));Object.defineProperty(su.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var uu=function(t){Y(n,t);var e=X(n);function n(t,r){var i;return B(this,n),(i=e.call(this,"Transaction was not confirmed in ".concat(r.toFixed(2)," seconds. It is ")+"unknown if it succeeded or failed. Check signature "+"".concat(t," using the Solana Explorer or CLI tools."))).signature=void 0,i.signature=t,i}return U(n)}(G(Error));Object.defineProperty(uu.prototype,"name",{value:"TransactionExpiredTimeoutError"});var cu=function(t){Y(n,t);var e=X(n);function n(t){var r;return B(this,n),(r=e.call(this,"Signature ".concat(t," has expired: the nonce is no longer valid."))).signature=void 0,r.signature=t,r}return U(n)}(G(Error));Object.defineProperty(cu.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});var lu=function(){function t(e,n){B(this,t),this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=n}return U(t,[{key:"keySegments",value:function(){var t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}},{key:"get",value:function(t){var e,n=st(this.keySegments());try{for(n.s();!(e=n.n()).done;){var r=e.value;if(t256)throw new Error("Account index overflow encountered during compilation");var e=new Map;this.keySegments().flat().forEach((function(t,n){e.set(t.toBase58(),n)}));var n=function(t){var n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((function(t){return{programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((function(t){return n(t.pubkey)})),data:t.data}}))}}]),t}(),hu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey";return Ji(32,t)},du=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature";return Ji(64,t)},fu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",e=qi([Vi("length"),Vi("lengthPadding"),Ji(Yi(Vi(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),i=e;return i.decode=function(t,e){return n(t,e).chars.toString()},i.encode=function(t,e,n){var i={chars:It.from(t,"utf8")};return r(i,e,n)},i.alloc=function(t){return Vi().span+Vi().span+It.from(t,"utf8").length},i};function pu(t,e){var n=function t(n){if(n.span>=0)return n.span;if("function"==typeof n.alloc)return n.alloc(e[n.property]);if("count"in n&&"elementLayout"in n){var r=e[n.property];if(Array.isArray(r))return r.length*t(n.elementLayout)}else if("fields"in n)return pu({layout:n},e[n.property]);return 0},r=0;return t.layout.fields.forEach((function(t){r+=n(t)})),r}function yu(t){for(var e=0,n=0;;){var r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function mu(t,e){for(var n=e;;){var r=127&n;if(0==(n>>=7)){t.push(r);break}r|=128,t.push(r)}}function gu(t,e){if(!t)throw new Error(e||"Assertion failed")}var vu=function(){function t(e,n){B(this,t),this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=n}return U(t,[{key:"getMessageComponents",value:function(){var t=et(this.keyMetaMap.entries());gu(t.length<=256,"Max static account keys length exceeded");var e=t.filter((function(t){var e=tt(t,2)[1];return e.isSigner&&e.isWritable})),n=t.filter((function(t){var e=tt(t,2)[1];return e.isSigner&&!e.isWritable})),r=t.filter((function(t){var e=tt(t,2)[1];return!e.isSigner&&e.isWritable})),i=t.filter((function(t){var e=tt(t,2)[1];return!e.isSigner&&!e.isWritable})),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};return gu(e.length>0,"Expected at least one writable signer key"),gu(tt(e[0],1)[0]===this.payer.toBase58(),"Expected first writable signer key to be the fee payer"),[o,[].concat(et(e.map((function(t){var e=tt(t,1)[0];return new eu(e)}))),et(n.map((function(t){var e=tt(t,1)[0];return new eu(e)}))),et(r.map((function(t){var e=tt(t,1)[0];return new eu(e)}))),et(i.map((function(t){var e=tt(t,1)[0];return new eu(e)}))))]}},{key:"extractTableLookup",value:function(t){var e=tt(this.drainKeysFoundInLookupTable(t.state.addresses,(function(t){return!t.isSigner&&!t.isInvoked&&t.isWritable})),2),n=e[0],r=e[1],i=tt(this.drainKeysFoundInLookupTable(t.state.addresses,(function(t){return!t.isSigner&&!t.isInvoked&&!t.isWritable})),2),o=i[0],a=i[1];if(0!==n.length||0!==o.length)return[{accountKey:t.key,writableIndexes:n,readonlyIndexes:o},{writable:r,readonly:a}]}},{key:"drainKeysFoundInLookupTable",value:function(t,e){var n,r=this,i=new Array,o=new Array,a=st(this.keyMetaMap.entries());try{var s=function(){var a=tt(n.value,2),s=a[0],u=a[1];if(e(u)){var c=new eu(s),l=t.findIndex((function(t){return t.equals(c)}));l>=0&&(gu(l<256,"Max lookup table index exceeded"),i.push(l),o.push(c),r.keyMetaMap.delete(s))}};for(a.s();!(n=a.n()).done;)s()}catch(t){a.e(t)}finally{a.f()}return[i,o]}}],[{key:"compile",value:function(e,n){var r=new Map,i=function(t){var e=t.toBase58(),n=r.get(e);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(e,n)),n},o=i(n);o.isSigner=!0,o.isWritable=!0;var a,s=st(e);try{for(s.s();!(a=s.n()).done;){var u=a.value;i(u.programId).isInvoked=!0;var c,l=st(u.keys);try{for(l.s();!(c=l.n()).done;){var h=c.value,d=i(h.pubkey);d.isSigner||(d.isSigner=h.isSigner),d.isWritable||(d.isWritable=h.isWritable)}}catch(t){l.e(t)}finally{l.f()}}}catch(t){s.e(t)}finally{s.f()}return new t(n,r)}}]),t}(),wu=function(){function t(e){var n=this;B(this,t),this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map((function(t){return new eu(t)})),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach((function(t){return n.indexToProgramIds.set(t.programIdIndex,n.accountKeys[t.programIdIndex])}))}return U(t,[{key:"version",get:function(){return"legacy"}},{key:"staticAccountKeys",get:function(){return this.accountKeys}},{key:"compiledInstructions",get:function(){return this.instructions.map((function(t){return{programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:fr.decode(t.data)}}))}},{key:"addressTableLookups",get:function(){return[]}},{key:"getAccountKeys",value:function(){return new lu(this.staticAccountKeys)}},{key:"isAccountSigner",value:function(t){return t=this.header.numRequiredSignatures?t-e0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new lu(this.staticAccountKeys,e)}},{key:"isAccountSigner",value:function(t){return t=n?t-n=this.header.numRequiredSignatures?t-e0?this.signatures[0].signature:null}},{key:"toJSON",value:function(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((function(t){return t.toJSON()})),signers:this.signatures.map((function(t){return t.publicKey.toJSON()}))}}},{key:"add",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(var r=0;r-1?(a[n].isWritable=a[n].isWritable||t.isWritable,a[n].isSigner=a[n].isSigner||t.isSigner):a.push(t)})),a.sort((function(t,e){if(t.isSigner!==e.isSigner)return t.isSigner?-1:1;if(t.isWritable!==e.isWritable)return t.isWritable?-1:1;return t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));var s=a.findIndex((function(t){return t.pubkey.equals(n)}));if(s>-1){var u=tt(a.splice(s,1),1)[0];u.isSigner=!0,u.isWritable=!0,a.unshift(u)}else a.unshift({pubkey:n,isSigner:!0,isWritable:!0});var c,l=st(this.signatures);try{var h=function(){var t=c.value,e=a.findIndex((function(e){return e.pubkey.equals(t.publicKey)}));if(!(e>-1))throw new Error("unknown signer: ".concat(t.publicKey.toString()));a[e].isSigner||(a[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))};for(l.s();!(c=l.n()).done;)h()}catch(t){l.e(t)}finally{l.f()}var d=0,f=0,p=0,y=[],m=[];a.forEach((function(t){var e=t.pubkey,n=t.isSigner,r=t.isWritable;n?(y.push(e.toString()),d+=1,r||(f+=1)):(m.push(e.toString()),r||(p+=1))}));var g=y.concat(m),v=e.map((function(t){var e=t.data,n=t.programId;return{programIdIndex:g.indexOf(n.toString()),accounts:t.keys.map((function(t){return g.indexOf(t.pubkey.toString())})),data:fr.encode(e)}}));return v.forEach((function(t){gu(t.programIdIndex>=0),t.accounts.forEach((function(t){return gu(t>=0)}))})),new wu({header:{numRequiredSignatures:d,numReadonlySignedAccounts:f,numReadonlyUnsignedAccounts:p},accountKeys:g,recentBlockhash:t,instructions:v})}},{key:"_compile",value:function(){var t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);if(this.signatures.length===e.length&&this.signatures.every((function(t,n){return e[n].equals(t.publicKey)})))return t;return this.signatures=e.map((function(t){return{signature:null,publicKey:t}})),t}},{key:"serializeMessage",value:function(){return this._compile().serialize()}},{key:"getEstimatedFee",value:(e=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getFeeForMessage(this.compileMessage());case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"setSigners",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n1?r-1:0),o=1;o ").concat(iu)),i}},{key:"keys",get:function(){return gu(1===this.instructions.length),this.instructions[0].keys.map((function(t){return t.pubkey}))}},{key:"programId",get:function(){return gu(1===this.instructions.length),this.instructions[0].programId}},{key:"data",get:function(){return gu(1===this.instructions.length),this.instructions[0].data}}],[{key:"from",value:function(e){for(var n=et(e),r=yu(n),i=[],o=0;o1&&void 0!==arguments[1]?arguments[1]:[],r=new t;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),n.forEach((function(t,n){var i={signature:t==fr.encode(Nu)?null:fr.decode(t),publicKey:e.accountKeys[n]};r.signatures.push(i)})),e.instructions.forEach((function(t){var n=t.accounts.map((function(t){var n=e.accountKeys[t];return{pubkey:n,isSigner:r.signatures.some((function(t){return t.publicKey.toString()===n.toString()}))||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}}));r.instructions.push(new Iu({keys:n,programId:e.accountKeys[t.programIdIndex],data:fr.decode(t.data)}))})),r._message=e,r._json=r.toJSON(),r}}]),t}(),xu=function(){function t(e){B(this,t),this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}return U(t,[{key:"compileToLegacyMessage",value:function(){return wu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}},{key:"compileToV0Message",value:function(t){return bu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:t})}}],[{key:"decompile",value:function(e,n){var r=e.header,i=e.compiledInstructions,o=e.recentBlockhash,a=r.numRequiredSignatures,s=r.numReadonlySignedAccounts,u=r.numReadonlyUnsignedAccounts,c=a-s;gu(c>0,"Message header is invalid");var l=e.staticAccountKeys.length-a-u;gu(l>=0,"Message header is invalid");var h=e.getAccountKeys(n),d=h.get(0);if(void 0===d)throw new Error("Failed to decompile message because no account keys were found");var f,p=[],y=st(i);try{for(y.s();!(f=y.n()).done;){var m,g=f.value,v=[],w=st(g.accountKeyIndexes);try{for(w.s();!(m=w.n()).done;){var b=m.value,M=h.get(b);if(void 0===M)throw new Error("Failed to find key for account key index ".concat(b));var A=void 0;A=b=0,"Cannot sign with non signer key ".concat(t.publicKey.toBase58())),n.signatures[o]=Gs(r,t.secretKey)};for(o.s();!(e=o.n()).done;)a()}catch(t){o.e(t)}finally{o.f()}}},{key:"addSignature",value:function(t,e){gu(64===e.byteLength,"Signature must be 64 bytes long");var n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((function(e){return e.equals(t)}));gu(n>=0,"Can not add signature; `".concat(t.toBase58(),"` is not required to sign this transaction")),this.signatures[n]=e}}],[{key:"deserialize",value:function(e){for(var n=et(e),r=[],i=yu(n),o=0;o=0?t.layout.span:pu(t,e),r=It.alloc(n),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,r),r}function Qu(t,e){var n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error("invalid instruction; instruction index mismatch ".concat(n.instruction," != ").concat(t.index));return n}var Yu,Wu=Hi("lamportsPerSignature"),Fu=qi([Vi("version"),Vi("state"),hu("authorizedPubkey"),hu("nonce"),qi([Wu],"feeCalculator")]),Vu=Fu.span,Hu=function(){function t(e){B(this,t),this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}return U(t,null,[{key:"fromAccountData",value:function(e){var n=Fu.decode(Zs(e),0);return new t({authorizedPubkey:new eu(n.authorizedPubkey),nonce:new eu(n.nonce).toString(),feeCalculator:n.feeCalculator})}}]),t}(),Gu=(Yu=8,function(t){var e=Ji(Yu,t),n=function(t){return{decode:t.decode.bind(t),encode:t.encode.bind(t)}}(e),r=n.encode,i=n.decode,o=e;return o.decode=function(t,e){var n=i(t,e);return Ki(It.from(n))},o.encode=function(t,e,n){var i=$i(t,Yu);return r(i,e,n)},o}),qu=function(){function t(){B(this,t)}return U(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=Vi("instruction").decode(t.data),r=0,i=Object.entries(Zu);r0?s:1,space:a.length,programId:o}));case 17:if(null===c){e.next=20;break}return e.next=20,_u(n,c,[r,i],{commitment:"confirmed"});case 20:l=qi([Vi("instruction"),Vi("offset"),Vi("bytesLength"),Vi("bytesLengthPadding"),Zi(Wi("byte"),Yi(Vi(),-8),"bytes")]),h=t.chunkSize,d=0,f=a,p=[];case 25:if(!(f.length>0)){e.next=39;break}if(y=f.slice(0,h),m=It.alloc(h+16),l.encode({instruction:0,offset:d,bytes:y,bytesLength:0,bytesLengthPadding:0},m),g=(new Eu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:m}),p.push(_u(n,g,[r,i],{commitment:"confirmed"})),!n._rpcEndpoint.includes("solana.com")){e.next=35;break}return e.next=35,Ru(250);case 35:d+=h,f=f.slice(h),e.next=25;break;case 39:return e.next=41,Promise.all(p);case 41:return v=qi([Vi("instruction")]),w=It.alloc(v.span),v.encode({instruction:1},w),b=(new Eu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0},{pubkey:Cu,isSigner:!1,isWritable:!1}],programId:o,data:w}),M="processed",e.next=48,n.sendTransaction(b,[r,i],{preflightCommitment:M});case 48:return A=e.sent,e.next=51,n.confirmTransaction({signature:A,lastValidBlockHeight:b.lastValidBlockHeight,blockhash:b.recentBlockhash},M);case 51:if(N=e.sent,I=N.context,!(E=N.value).err){e.next=56;break}throw new Error("Transaction ".concat(A," failed (").concat(JSON.stringify(E),")"));case 56:return e.prev=57,e.next=60,n.getSlot({commitment:M});case 60:if(!(e.sent>I.slot)){e.next=63;break}return e.abrupt("break",71);case 63:e.next=67;break;case 65:e.prev=65,e.t0=e.catch(57);case 67:return e.next=69,new Promise((function(t){return setTimeout(t,Math.round(200))}));case 69:e.next=56;break;case 71:return e.abrupt("return",!0);case 72:case"end":return e.stop()}}),e,null,[[57,65]])}))),function(t,n,r,i,o){return e.apply(this,arguments)})}]),t}();Xu.chunkSize=932;var Ku=new eu("BPFLoader2111111111111111111111111111111111"),$u=function(){function t(){B(this,t)}return U(t,null,[{key:"getMinNumSignatures",value:function(t){return Xu.getMinNumSignatures(t)}},{key:"load",value:function(t,e,n,r,i){return Xu.load(t,e,n,i,r)}}]),t}();function tc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ec=Object.prototype.toString,nc=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function rc(t,e){var n,r,i,o,a,s,u;if(!0===t)return"true";if(!1===t)return"false";switch(z(t)){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return rc(t.toJSON(),e);if("[object Array]"===(u=ec.call(t))){for(i="[",r=t.length-1,n=0;n-1&&(i+=rc(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=nc(t).sort()).length,i="",n=0;n1;)t/=2,e++;return e}var ac=function(){function t(e,n,r,i,o){B(this,t),this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=n,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=o}return U(t,[{key:"getEpoch",value:function(t){return this.getEpochAndSlotIndex(t)[0]}},{key:"getEpochAndSlotIndex",value:function(t){if(t>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32))}(t+32+1))-oc(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}var n=t-this.firstNormalSlot,r=Math.floor(n/this.slotsPerEpoch);return[this.firstNormalEpoch+r,n%this.slotsPerEpoch]}},{key:"getFirstSlotInEpoch",value:function(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}},{key:"getLastSlotInEpoch",value:function(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}},{key:"getSlotsInEpoch",value:function(t){return t0&&(i.until=a.signatures[a.signatures.length-1].toString()),t.next=22;break;case 15:if(t.prev=15,t.t0=t.catch(8),!(t.t0 instanceof Error&&t.t0.message.includes("skipped"))){t.next=21;break}return t.abrupt("continue",4);case 21:throw t.t0;case 22:t.next=4;break;case 24:return t.next=26,this.getSlot("finalized");case 26:s=t.sent;case 27:if("before"in i){t.next=47;break}if(!(++r>s)){t.next=31;break}return t.abrupt("break",47);case 31:return t.prev=31,t.next=34,this.getConfirmedBlockSignatures(r);case 34:(u=t.sent).signatures.length>0&&(i.before=u.signatures[u.signatures.length-1].toString()),t.next=45;break;case 38:if(t.prev=38,t.t1=t.catch(31),!(t.t1 instanceof Error&&t.t1.message.includes("skipped"))){t.next=44;break}return t.abrupt("continue",27);case 44:throw t.t1;case 45:t.next=27;break;case 47:return t.next=49,this.getConfirmedSignaturesForAddress2(e,i);case 49:return c=t.sent,t.abrupt("return",c.map((function(t){return t.signature})));case 51:case"end":return t.stop()}}),t,this,[[8,15],[31,38]])}))),function(t,e,n){return N.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress2",value:(A=_(O().mark((function t(e,n,r){var i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,n),t.next=3,this._rpcRequest("getConfirmedSignaturesForAddress2",i);case 3:if(o=t.sent,!("error"in(a=po(o,rl)))){t.next=7;break}throw new uc(a.error,"failed to get confirmed signatures for address");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return A.apply(this,arguments)})},{key:"getSignaturesForAddress",value:(M=_(O().mark((function t(e,n,r){var i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,n),t.next=3,this._rpcRequest("getSignaturesForAddress",i);case 3:if(o=t.sent,!("error"in(a=po(o,il)))){t.next=7;break}throw new uc(a.error,"failed to get signatures for address");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return M.apply(this,arguments)})},{key:"getAddressLookupTable",value:(b=_(O().mark((function t(e,n){var r,i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAccountInfoAndContext(e,n);case 2:return r=t.sent,i=r.context,o=r.value,a=null,null!==o&&(a=new hc({key:e,state:hc.deserialize(o.data)})),t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return b.apply(this,arguments)})},{key:"getNonceAndContext",value:(w=_(O().mark((function t(e,n){var r,i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAccountInfoAndContext(e,n);case 2:return r=t.sent,i=r.context,o=r.value,a=null,null!==o&&(a=Hu.fromAccountData(o.data)),t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return w.apply(this,arguments)})},{key:"getNonce",value:(v=_(O().mark((function t(e,n){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getNonceAndContext(e,n).then((function(t){return t.value})).catch((function(t){throw new Error("failed to get nonce for account "+e.toBase58()+": "+t)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return v.apply(this,arguments)})},{key:"requestAirdrop",value:(g=_(O().mark((function t(e,n){var r,i;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("requestAirdrop",[e.toBase58(),n]);case 2:if(r=t.sent,!("error"in(i=po(r,Jl)))){t.next=6;break}throw new uc(i.error,"airdrop to ".concat(e.toBase58()," failed"));case 6:return t.abrupt("return",i.result);case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return g.apply(this,arguments)})},{key:"_blockhashWithExpiryBlockHeight",value:(m=_(O().mark((function t(e){var n,r;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=10;break}case 1:if(!this._pollingBlockhash){t.next=6;break}return t.next=4,Ru(100);case 4:t.next=1;break;case 6:if(n=Date.now()-this._blockhashInfo.lastFetch,r=n>=3e4,null===this._blockhashInfo.latestBlockhash||r){t.next=10;break}return t.abrupt("return",this._blockhashInfo.latestBlockhash);case 10:return t.next=12,this._pollNewBlockhash();case 12:return t.abrupt("return",t.sent);case 13:case"end":return t.stop()}}),t,this)}))),function(t){return m.apply(this,arguments)})},{key:"_pollNewBlockhash",value:(y=_(O().mark((function t(){var e,n,r,i,o;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._pollingBlockhash=!0,t.prev=1,e=Date.now(),n=this._blockhashInfo.latestBlockhash,r=n?n.blockhash:null,i=0;case 6:if(!(i<50)){t.next=18;break}return t.next=9,this.getLatestBlockhash("finalized");case 9:if(o=t.sent,r===o.blockhash){t.next=13;break}return this._blockhashInfo={latestBlockhash:o,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t.abrupt("return",o);case 13:return t.next=15,Ru(200);case 15:i++,t.next=6;break;case 18:throw new Error("Unable to obtain a new blockhash after ".concat(Date.now()-e,"ms"));case 19:return t.prev=19,this._pollingBlockhash=!1,t.finish(19);case 22:case"end":return t.stop()}}),t,this,[[1,,19,22]])}))),function(){return y.apply(this,arguments)})},{key:"getStakeMinimumDelegation",value:(p=_(O().mark((function t(e){var n,r,i,o,a,s;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=gc(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,"base64",i),t.next=4,this._rpcRequest("getStakeMinimumDelegation",o);case 4:if(a=t.sent,!("error"in(s=po(a,Mc(No()))))){t.next=8;break}throw new uc(s.error,"failed to get stake minimum delegation");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return p.apply(this,arguments)})},{key:"simulateTransaction",value:(f=_(O().mark((function t(e,n,r){var i,o,a,s,u,c,l,h,d,f,p,y,m,g,v,w,b,M,A,N,I,E,x,k,T,L;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("message"in e)){t.next=17;break}if(i=e.serialize(),o=It.from(i).toString("base64"),!Array.isArray(n)&&void 0===r){t.next=6;break}throw new Error("Invalid arguments");case 6:return(a=n||{}).encoding="base64","commitment"in a||(a.commitment=this.commitment),s=[o,a],t.next=12,this._rpcRequest("simulateTransaction",s);case 12:if(u=t.sent,!("error"in(c=po(u,zc)))){t.next=16;break}throw new Error("failed to simulate transaction: "+c.error.message);case 16:return t.abrupt("return",c.result);case 17:if(e instanceof Eu?(h=e,(l=new Eu).feePayer=h.feePayer,l.instructions=e.instructions,l.nonceInfo=h.nonceInfo,l.signatures=h.signatures):(l=Eu.populate(e))._message=l._json=void 0,void 0===n||Array.isArray(n)){t.next=20;break}throw new Error("Invalid arguments");case 20:if(d=n,!l.nonceInfo||!d){t.next=25;break}(f=l).sign.apply(f,et(d)),t.next=45;break;case 25:p=this._disableBlockhashCaching;case 26:return t.next=28,this._blockhashWithExpiryBlockHeight(p);case 28:if(m=t.sent,l.lastValidBlockHeight=m.lastValidBlockHeight,l.recentBlockhash=m.blockhash,d){t.next=33;break}return t.abrupt("break",45);case 33:if((y=l).sign.apply(y,et(d)),l.signature){t.next=36;break}throw new Error("!signature");case 36:if(g=l.signature.toString("base64"),this._blockhashInfo.simulatedSignatures.includes(g)||this._blockhashInfo.transactionSignatures.includes(g)){t.next=42;break}return this._blockhashInfo.simulatedSignatures.push(g),t.abrupt("break",45);case 42:p=!0;case 43:t.next=26;break;case 45:return v=l._compile(),w=v.serialize(),b=l._serialize(w),M=b.toString("base64"),A={encoding:"base64",commitment:this.commitment},r&&(N=(Array.isArray(r)?r:v.nonProgramIds()).map((function(t){return t.toBase58()})),A.accounts={encoding:"base64",addresses:N}),d&&(A.sigVerify=!0),I=[M,A],t.next=55,this._rpcRequest("simulateTransaction",I);case 55:if(E=t.sent,!("error"in(x=po(E,zc)))){t.next=60;break}throw"data"in x.error&&(k=x.error.data.logs)&&Array.isArray(k)&&(L=(T="\n ")+k.join(T),console.error(x.error.message,L)),new sc("failed to simulate transaction: "+x.error.message,k);case 60:return t.abrupt("return",x.result);case 61:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return f.apply(this,arguments)})},{key:"sendTransaction",value:(d=_(O().mark((function t(e,n,r){var i,o,a,s,u,c;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("version"in e)){t.next=7;break}if(!n||!Array.isArray(n)){t.next=3;break}throw new Error("Invalid arguments");case 3:return i=e.serialize(),t.next=6,this.sendRawTransaction(i,n);case 6:return t.abrupt("return",t.sent);case 7:if(void 0!==n&&Array.isArray(n)){t.next=9;break}throw new Error("Invalid arguments");case 9:if(o=n,!e.nonceInfo){t.next=14;break}e.sign.apply(e,et(o)),t.next=32;break;case 14:a=this._disableBlockhashCaching;case 15:return t.next=17,this._blockhashWithExpiryBlockHeight(a);case 17:if(s=t.sent,e.lastValidBlockHeight=s.lastValidBlockHeight,e.recentBlockhash=s.blockhash,e.sign.apply(e,et(o)),e.signature){t.next=23;break}throw new Error("!signature");case 23:if(u=e.signature.toString("base64"),this._blockhashInfo.transactionSignatures.includes(u)){t.next=29;break}return this._blockhashInfo.transactionSignatures.push(u),t.abrupt("break",32);case 29:a=!0;case 30:t.next=15;break;case 32:return c=e.serialize(),t.next=35,this.sendRawTransaction(c,r);case 35:return t.abrupt("return",t.sent);case 36:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return d.apply(this,arguments)})},{key:"sendRawTransaction",value:(h=_(O().mark((function t(e,n){var r,i;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Zs(e).toString("base64"),t.next=3,this.sendEncodedTransaction(r,n);case 3:return i=t.sent,t.abrupt("return",i);case 5:case"end":return t.stop()}}),t,this)}))),function(t,e){return h.apply(this,arguments)})},{key:"sendEncodedTransaction",value:(l=_(O().mark((function t(e,n){var r,i,o,a,s,u,c;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={encoding:"base64"},i=n&&n.skipPreflight,o=n&&n.preflightCommitment||this.commitment,n&&null!=n.maxRetries&&(r.maxRetries=n.maxRetries),n&&null!=n.minContextSlot&&(r.minContextSlot=n.minContextSlot),i&&(r.skipPreflight=i),o&&(r.preflightCommitment=o),a=[e,r],t.next=10,this._rpcRequest("sendTransaction",a);case 10:if(s=t.sent,!("error"in(u=po(s,Xl)))){t.next=15;break}throw"data"in u.error&&(c=u.error.data.logs),new sc("failed to send transaction: "+u.error.message,c);case 15:return t.abrupt("return",u.result);case 16:case"end":return t.stop()}}),t,this)}))),function(t,e){return l.apply(this,arguments)})},{key:"_wsOnOpen",value:function(){var t=this;this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((function(){_(O().mark((function e(){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t._rpcWebSocket.notify("ping");case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})))()}),5e3),this._updateSubscriptions()}},{key:"_wsOnError",value:function(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}},{key:"_wsOnClose",value:function(t){var e=this;this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((function(t){var n=tt(t,2),r=n[0],i=n[1];e._setSubscription(r,D(D({},i),{},{state:"pending"}))}))):this._updateSubscriptions()}},{key:"_setSubscription",value:function(t,e){var n,r=null===(n=this._subscriptionsByHash[t])||void 0===n?void 0:n.state;if(this._subscriptionsByHash[t]=e,r!==e.state){var i=this._subscriptionStateChangeCallbacksByHash[t];i&&i.forEach((function(t){try{t(e.state)}catch(t){}}))}}},{key:"_onSubscriptionStateChange",value:function(t,e){var n,r=this,i=this._subscriptionHashByClientSubscriptionId[t];if(null==i)return function(){};var o=(n=this._subscriptionStateChangeCallbacksByHash)[i]||(n[i]=new Set);return o.add(e),function(){o.delete(e),0===o.size&&delete r._subscriptionStateChangeCallbacksByHash[i]}}},{key:"_updateSubscriptions",value:(c=_(O().mark((function t(){var e,n,r=this;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==Object.keys(this._subscriptionsByHash).length){t.next=3;break}return this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((function(){r._rpcWebSocketIdleTimeout=null;try{r._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log("Error when closing socket connection: ".concat(t.message))}}),500)),t.abrupt("return");case 3:if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),this._rpcWebSocketConnected){t.next=7;break}return this._rpcWebSocket.connect(),t.abrupt("return");case 7:return e=this._rpcWebSocketGeneration,n=function(){return e===r._rpcWebSocketGeneration},t.next=11,Promise.all(Object.keys(this._subscriptionsByHash).map(function(){var t=_(O().mark((function t(e){var i;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(i=r._subscriptionsByHash[e])){t.next=3;break}return t.abrupt("return");case 3:t.t0=i.state,t.next="pending"===t.t0||"unsubscribed"===t.t0?6:"subscribed"===t.t0?15:19;break;case 6:if(0!==i.callbacks.size){t.next=12;break}return delete r._subscriptionsByHash[e],"unsubscribed"===i.state&&delete r._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],t.next=11,r._updateSubscriptions();case 11:return t.abrupt("return");case 12:return t.next=14,_(O().mark((function t(){var o,a,s;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=i.args,a=i.method,t.prev=1,r._setSubscription(e,D(D({},i),{},{state:"subscribing"})),t.next=5,r._rpcWebSocket.call(a,o);case 5:return s=t.sent,r._setSubscription(e,D(D({},i),{},{serverSubscriptionId:s,state:"subscribed"})),r._subscriptionCallbacksByServerSubscriptionId[s]=i.callbacks,t.next=10,r._updateSubscriptions();case 10:t.next=20;break;case 12:if(t.prev=12,t.t0=t.catch(1),t.t0 instanceof Error&&console.error("".concat(a," error for argument"),o,t.t0.message),n()){t.next=17;break}return t.abrupt("return");case 17:return r._setSubscription(e,D(D({},i),{},{state:"pending"})),t.next=20,r._updateSubscriptions();case 20:case"end":return t.stop()}}),t,null,[[1,12]])})))();case 14:return t.abrupt("break",19);case 15:if(0!==i.callbacks.size){t.next=18;break}return t.next=18,_(O().mark((function t(){var o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=i.serverSubscriptionId,a=i.unsubscribeMethod,!r._subscriptionsAutoDisposedByRpc.has(o)){t.next=5;break}r._subscriptionsAutoDisposedByRpc.delete(o),t.next=21;break;case 5:return r._setSubscription(e,D(D({},i),{},{state:"unsubscribing"})),r._setSubscription(e,D(D({},i),{},{state:"unsubscribing"})),t.prev=7,t.next=10,r._rpcWebSocket.call(a,[o]);case 10:t.next=21;break;case 12:if(t.prev=12,t.t0=t.catch(7),t.t0 instanceof Error&&console.error("".concat(a," error:"),t.t0.message),n()){t.next=17;break}return t.abrupt("return");case 17:return r._setSubscription(e,D(D({},i),{},{state:"subscribed"})),t.next=20,r._updateSubscriptions();case 20:return t.abrupt("return");case 21:return r._setSubscription(e,D(D({},i),{},{state:"unsubscribed"})),t.next=24,r._updateSubscriptions();case 24:case"end":return t.stop()}}),t,null,[[7,12]])})))();case 18:return t.abrupt("break",19);case 19:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 11:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"_handleServerNotification",value:function(t,e){var n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((function(t){try{t.apply(void 0,et(e))}catch(t){console.error(t)}}))}},{key:"_wsOnAccountNotification",value:function(t){var e=po(t,ol),n=e.result,r=e.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_makeSubscription",value:function(t,e){var n=this,r=this._nextClientSubscriptionId++,i=ic([t.method,e],!0),o=this._subscriptionsByHash[i];return void 0===o?this._subscriptionsByHash[i]=D(D({},t),{},{args:e,callbacks:new Set([t.callback]),state:"pending"}):o.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=_(O().mark((function e(){var o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return delete n._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete n._subscriptionHashByClientSubscriptionId[r],gu(void 0!==(o=n._subscriptionsByHash[i]),"Could not find a `Subscription` when tearing down client subscription #".concat(r)),o.callbacks.delete(t.callback),e.next=7,n._updateSubscriptions();case 7:case"end":return e.stop()}}),e)}))),this._updateSubscriptions(),r}},{key:"onAccountChange",value:function(t,e,n){var r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}},{key:"removeAccountChangeListener",value:(u=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"account change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"_wsOnProgramAccountNotification",value:function(t){var e=po(t,sl),n=e.result,r=e.subscription;this._handleServerNotification(r,[{accountId:n.value.pubkey,accountInfo:n.value.account},n.context])}},{key:"onProgramAccountChange",value:function(t,e,n,r){var i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}},{key:"removeProgramAccountChangeListener",value:(s=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"program account change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"onLogs",value:function(t,e,n){var r=this._buildArgs(["object"===z(t)?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}},{key:"removeOnLogsListener",value:(a=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"logs");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"_wsOnLogsNotification",value:function(t){var e=po(t,$l),n=e.result,r=e.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_wsOnSlotNotification",value:function(t){var e=po(t,cl),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotChange",value:function(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}},{key:"removeSlotChangeListener",value:(o=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"slot change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"_wsOnSlotUpdatesNotification",value:function(t){var e=po(t,hl),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotUpdate",value:function(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}},{key:"removeSlotUpdateListener",value:(i=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"slot update");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"_unsubscribeClientSubscription",value:(r=_(O().mark((function t(e,n){var r;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r=this._subscriptionDisposeFunctionsByClientSubscriptionId[e])){t.next=6;break}return t.next=4,r();case 4:t.next=7;break;case 6:console.warn("Ignored unsubscribe request because an active subscription with id "+"`".concat(e,"` for '").concat(n,"' events ")+"could not be found.");case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"_buildArgs",value:function(t,e,n,r){var i=e||this._commitment;if(i||n||r){var o={};n&&(o.encoding=n),i&&(o.commitment=i),r&&(o=Object.assign(o,r)),t.push(o)}return t}},{key:"_buildArgsAtLeastConfirmed",value:function(t,e,n,r){var i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}},{key:"_wsOnSignatureNotification",value:function(t){var e=po(t,dl),n=e.result,r=e.subscription;"receivedSignature"!==n.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===n.value?[{type:"received"},n.context]:[{type:"status",result:n.value},n.context])}},{key:"onSignature",value:function(t,e,n){var r=this,i=this._buildArgs([t],n||this._commitment||"finalized"),o=this._makeSubscription({callback:function(t,n){if("status"===t.type){e(t.result,n);try{r.removeSignatureListener(o)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return o}},{key:"onSignatureWithOptions",value:function(t,e,n){var r=this,i=D(D({},n),{},{commitment:n&&n.commitment||this._commitment||"finalized"}),o=i.commitment,a=q(i,Qs),s=this._buildArgs([t],o,void 0,a),u=this._makeSubscription({callback:function(t,n){e(t,n);try{r.removeSignatureListener(u)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return u}},{key:"removeSignatureListener",value:(n=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"signature result");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"_wsOnRootNotification",value:function(t){var e=po(t,fl),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onRootChange",value:function(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}},{key:"removeRootChangeListener",value:(e=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"root change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),t}(),nh=function(){function t(e){B(this,t),this._keypair=void 0,this._keypair=null!=e?e:Ws()}return U(t,[{key:"publicKey",get:function(){return new eu(this._keypair.publicKey)}},{key:"secretKey",get:function(){return new Uint8Array(this._keypair.secretKey)}}],[{key:"generate",value:function(){return new t(Ws())}},{key:"fromSecretKey",value:function(e,n){if(64!==e.byteLength)throw new Error("bad secret key size");var r=e.slice(32,64);if(!n||!n.skipValidation)for(var i=e.slice(0,32),o=Fs(i),a=0;a<32;a++)if(r[a]!==o[a])throw new Error("provided secretKey is invalid");return new t({publicKey:r,secretKey:e})}},{key:"fromSeed",value:function(e){var n=Fs(e),r=new Uint8Array(64);return r.set(e),r.set(n,32),new t({publicKey:n,secretKey:r})}}]),t}(),rh=Object.freeze({CreateLookupTable:{index:0,layout:qi([Vi("instruction"),Gu("recentSlot"),Wi("bumpSeed")])},FreezeLookupTable:{index:1,layout:qi([Vi("instruction")])},ExtendLookupTable:{index:2,layout:qi([Vi("instruction"),Gu(),Zi(hu(),Yi(Vi(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:qi([Vi("instruction")])},CloseLookupTable:{index:4,layout:qi([Vi("instruction")])}}),ih=function(){function t(){B(this,t)}return U(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=Vi("instruction").decode(t.data),r=0,i=Object.entries(rh);r2?t.keys[2].pubkey:void 0,addresses:e.map((function(t){return new eu(t)}))}}},{key:"decodeCloseLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}},{key:"decodeFreezeLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}},{key:"decodeDeactivateLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(oh.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}},{key:"checkKeysLength",value:function(t,e){if(t.length3&&(i.custodianPubkey=t.keys[3].pubkey),i}},{key:"decodeAuthorizeWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=Qu(wh.AuthorizeWithSeed,t.data),n=e.newAuthorized,r=e.stakeAuthorizationType,i=e.authoritySeed,o=e.authorityOwner,a={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:i,authorityOwner:new eu(o),newAuthorizedPubkey:new eu(n),stakeAuthorizationType:{index:r}};return t.keys.length>3&&(a.custodianPubkey=t.keys[3].pubkey),a}},{key:"decodeSplit",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=Qu(wh.Split,t.data).lamports;return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}},{key:"decodeMerge",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Qu(wh.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}},{key:"decodeWithdraw",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);var e=Qu(wh.Withdraw,t.data).lamports,n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}},{key:"decodeDeactivate",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Qu(wh.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(Mh.programId))throw new Error("invalid instruction; programId is not StakeProgram")}},{key:"checkKeyLength",value:function(t,e){if(t.length0&&void 0!==arguments[0]?arguments[0]:"authorized";return qi([hu("staker"),hu("withdrawer")],t)}(),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return qi([Gi("unixTimestamp"),Gi("epoch"),hu("custodian")],t)}()])},Authorize:{index:1,layout:qi([Vi("instruction"),hu("newAuthorized"),Vi("stakeAuthorizationType")])},Delegate:{index:2,layout:qi([Vi("instruction")])},Split:{index:3,layout:qi([Vi("instruction"),Gi("lamports")])},Withdraw:{index:4,layout:qi([Vi("instruction"),Gi("lamports")])},Deactivate:{index:5,layout:qi([Vi("instruction")])},Merge:{index:7,layout:qi([Vi("instruction")])},AuthorizeWithSeed:{index:8,layout:qi([Vi("instruction"),hu("newAuthorized"),Vi("stakeAuthorizationType"),fu("authoritySeed"),hu("authorityOwner")])}}),bh=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),Mh=function(){function t(){B(this,t)}return U(t,null,[{key:"initialize",value:function(t){var e=t.stakePubkey,n=t.authorized,r=t.lockup||gh.default,i=Uu(wh.Initialize,{authorized:{staker:Zs(n.staker.toBuffer()),withdrawer:Zs(n.withdrawer.toBuffer())},lockup:{unixTimestamp:r.unixTimestamp,epoch:r.epoch,custodian:Zs(r.custodian.toBuffer())}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Cu,isSigner:!1,isWritable:!1}],programId:this.programId,data:i};return new Iu(o)}},{key:"createAccountWithSeed",value:function(t){var e=new Eu;e.add(Ju.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));var n=t.stakePubkey,r=t.authorized,i=t.lockup;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"createAccount",value:function(t){var e=new Eu;e.add(Ju.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));var n=t.stakePubkey,r=t.authorized,i=t.lockup;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"delegate",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.votePubkey,i=Uu(wh.Delegate);return(new Eu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:Pu,isSigner:!1,isWritable:!1},{pubkey:yh,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"authorize",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.newAuthorizedPubkey,i=t.stakeAuthorizationType,o=t.custodianPubkey,a=Uu(wh.Authorize,{newAuthorized:Zs(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Tu,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new Eu).add({keys:s,programId:this.programId,data:a})}},{key:"authorizeWithSeed",value:function(t){var e=t.stakePubkey,n=t.authorityBase,r=t.authoritySeed,i=t.authorityOwner,o=t.newAuthorizedPubkey,a=t.stakeAuthorizationType,s=t.custodianPubkey,u=Uu(wh.AuthorizeWithSeed,{newAuthorized:Zs(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:Zs(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:Tu,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new Eu).add({keys:c,programId:this.programId,data:u})}},{key:"splitInstruction",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.splitStakePubkey,i=t.lamports,o=Uu(wh.Split,{lamports:i});return new Iu({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}},{key:"split",value:function(t){var e=new Eu;return e.add(Ju.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}},{key:"splitWithSeed",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.splitStakePubkey,i=t.basePubkey,o=t.seed,a=t.lamports,s=new Eu;return s.add(Ju.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}},{key:"merge",value:function(t){var e=t.stakePubkey,n=t.sourceStakePubKey,r=t.authorizedPubkey,i=Uu(wh.Merge);return(new Eu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:Pu,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"withdraw",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.toPubkey,i=t.lamports,o=t.custodianPubkey,a=Uu(wh.Withdraw,{lamports:i}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:Pu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new Eu).add({keys:s,programId:this.programId,data:a})}},{key:"deactivate",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=Uu(wh.Deactivate);return(new Eu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}]),t}();Mh.programId=new eu("Stake11111111111111111111111111111111111111"),Mh.space=200;var Ah=U((function t(e,n,r,i){B(this,t),this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=e,this.authorizedVoter=n,this.authorizedWithdrawer=r,this.commission=i})),Nh=function(){function t(){B(this,t)}return U(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=Vi("instruction").decode(t.data),r=0,i=Object.entries(Ih);r0&&void 0!==arguments[0]?arguments[0]:"voteInit";return qi([hu("nodePubkey"),hu("authorizedVoter"),hu("authorizedWithdrawer"),Wi("commission")],t)}()])},Authorize:{index:1,layout:qi([Vi("instruction"),hu("newAuthorized"),Vi("voteAuthorizationType")])},Withdraw:{index:3,layout:qi([Vi("instruction"),Gi("lamports")])},AuthorizeWithSeed:{index:10,layout:qi([Vi("instruction"),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return qi([Vi("voteAuthorizationType"),hu("currentAuthorityDerivedKeyOwnerPubkey"),fu("currentAuthorityDerivedKeySeed"),hu("newAuthorized")],t)}()])}}),Eh=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),xh=function(){function t(){B(this,t)}return U(t,null,[{key:"initializeAccount",value:function(t){var e=t.votePubkey,n=t.nodePubkey,r=t.voteInit,i=Uu(Ih.InitializeAccount,{voteInit:{nodePubkey:Zs(r.nodePubkey.toBuffer()),authorizedVoter:Zs(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Zs(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Cu,isSigner:!1,isWritable:!1},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new Iu(o)}},{key:"createAccount",value:function(t){var e=new Eu;return e.add(Ju.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}},{key:"authorize",value:function(t){var e=t.votePubkey,n=t.authorizedPubkey,r=t.newAuthorizedPubkey,i=t.voteAuthorizationType,o=Uu(Ih.Authorize,{newAuthorized:Zs(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Eu).add({keys:a,programId:this.programId,data:o})}},{key:"authorizeWithSeed",value:function(t){var e=t.currentAuthorityDerivedKeyBasePubkey,n=t.currentAuthorityDerivedKeyOwnerPubkey,r=t.currentAuthorityDerivedKeySeed,i=t.newAuthorizedPubkey,o=t.voteAuthorizationType,a=t.votePubkey,s=Uu(Ih.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Zs(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Zs(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new Eu).add({keys:u,programId:this.programId,data:s})}},{key:"withdraw",value:function(t){var e=t.votePubkey,n=t.authorizedWithdrawerPubkey,r=t.lamports,i=t.toPubkey,o=Uu(Ih.Withdraw,{lamports:r}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Eu).add({keys:a,programId:this.programId,data:o})}},{key:"safeWithdraw",value:function(e,n,r){if(e.lamports>n-r)throw new Error("Withdraw will leave vote account with insuffcient funds.");return t.withdraw(e)}}]),t}();xh.programId=new eu("Vote111111111111111111111111111111111111111"),xh.space=3731;var kh=new eu("Va1idator1nfo111111111111111111111111111111"),Th=To({name:xo(),website:Io(xo()),details:Io(xo()),keybaseUsername:Io(xo())}),Lh=function(){function t(e,n){B(this,t),this.key=void 0,this.info=void 0,this.key=e,this.info=n}return U(t,null,[{key:"fromConfigData",value:function(e){var n=et(e);if(2!==yu(n))return null;for(var r=[],i=0;i<2;i++){var o=new eu(n.slice(0,$s)),a=1===(n=n.slice($s)).slice(0,1)[0];n=n.slice(1),r.push({publicKey:o,isSigner:a})}if(r[0].publicKey.equals(kh)&&r[1].isSigner){var s=fu().decode(It.from(n)),u=JSON.parse(s);return fo(u,Th),new t(r[1].publicKey,u)}return null}}]),t}(),Sh=new eu("Vote111111111111111111111111111111111111111"),jh=qi([hu("nodePubkey"),hu("authorizedWithdrawer"),Wi("commission"),Hi(),Zi(qi([Hi("slot"),Vi("confirmationCount")]),Yi(Vi(),-8),"votes"),Wi("rootSlotValid"),Hi("rootSlot"),Hi(),Zi(qi([Hi("epoch"),hu("authorizedVoter")]),Yi(Vi(),-8),"authorizedVoters"),qi([Zi(qi([hu("authorizedPubkey"),Hi("epochOfLastAuthorizedSwitch"),Hi("targetEpoch")]),32,"buf"),Hi("idx"),Wi("isEmpty")],"priorVoters"),Hi(),Zi(qi([Hi("epoch"),Hi("credits"),Hi("prevCredits")]),Yi(Vi(),-8),"epochCredits"),qi([Hi("slot"),Hi("timestamp")],"lastTimestamp")]),Ch=function(){function t(e){B(this,t),this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}return U(t,null,[{key:"fromAccountData",value:function(e){var n=jh.decode(Zs(e),4),r=n.rootSlot;return n.rootSlotValid||(r=null),new t({nodePubkey:new eu(n.nodePubkey),authorizedWithdrawer:new eu(n.authorizedWithdrawer),commission:n.commission,votes:n.votes,rootSlot:r,authorizedVoters:n.authorizedVoters.map(Dh),priorVoters:zh(n.priorVoters),epochCredits:n.epochCredits,lastTimestamp:n.lastTimestamp})}}]),t}();function Dh(t){var e=t.authorizedVoter;return{epoch:t.epoch,authorizedVoter:new eu(e)}}function Oh(t){var e=t.authorizedPubkey,n=t.epochOfLastAuthorizedSwitch,r=t.targetEpoch;return{authorizedPubkey:new eu(e),epochOfLastAuthorizedSwitch:n,targetEpoch:r}}function zh(t){var e=t.buf,n=t.idx;return t.isEmpty?[]:[].concat(et(e.slice(n+1).map(Oh)),et(e.slice(0,n).map(Oh)))}var Ph={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function _h(){return(_h=_(O().mark((function t(e,n,r,i){var o,a,s,u,c,l,h;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r&&Object.prototype.hasOwnProperty.call(r,"lastValidBlockHeight")||r&&Object.prototype.hasOwnProperty.call(r,"nonceValue")?(o=r,a=i):a=r,s=a&&{skipPreflight:a.skipPreflight,preflightCommitment:a.preflightCommitment||a.commitment,minContextSlot:a.minContextSlot},t.next=4,e.sendRawTransaction(n,s);case 4:return u=t.sent,c=a&&a.commitment,l=o?e.confirmTransaction(o,c):e.confirmTransaction(u,c),t.next=9,l;case 9:if(!(h=t.sent.value).err){t.next=12;break}throw new Error("Raw transaction ".concat(u," failed (").concat(JSON.stringify(h),")"));case 12:return t.abrupt("return",u);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Bh=j(Object.freeze({__proto__:null,Account:nu,AddressLookupTableAccount:hc,AddressLookupTableInstruction:ih,AddressLookupTableProgram:oh,Authorized:mh,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:ru,BPF_LOADER_PROGRAM_ID:Ku,BpfLoader:$u,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:sh,ComputeBudgetInstruction:ah,ComputeBudgetProgram:uh,Connection:eh,Ed25519Program:lh,Enum:Xs,EpochSchedule:ac,FeeCalculatorLayout:Wu,Keypair:nh,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:rh,Loader:Xu,Lockup:gh,MAX_SEED_LENGTH:32,Message:wu,MessageAccountKeys:lu,MessageV0:bu,NONCE_ACCOUNT_LENGTH:Vu,NonceAccount:Hu,PACKET_DATA_SIZE:iu,PUBLIC_KEY_LENGTH:$s,PublicKey:eu,SIGNATURE_LENGTH_IN_BYTES:au,SOLANA_SCHEMA:Ks,STAKE_CONFIG_ID:yh,STAKE_INSTRUCTION_LAYOUTS:wh,SYSTEM_INSTRUCTION_LAYOUTS:Zu,SYSVAR_CLOCK_PUBKEY:Tu,SYSVAR_EPOCH_SCHEDULE_PUBKEY:Lu,SYSVAR_INSTRUCTIONS_PUBKEY:Su,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:ju,SYSVAR_RENT_PUBKEY:Cu,SYSVAR_REWARDS_PUBKEY:Du,SYSVAR_SLOT_HASHES_PUBKEY:Ou,SYSVAR_SLOT_HISTORY_PUBKEY:zu,SYSVAR_STAKE_HISTORY_PUBKEY:Pu,Secp256k1Program:ph,SendTransactionError:sc,SolanaJSONRPCError:uc,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:bh,StakeInstruction:vh,StakeProgram:Mh,Struct:Js,SystemInstruction:qu,SystemProgram:Ju,Transaction:Eu,TransactionExpiredBlockheightExceededError:su,TransactionExpiredNonceInvalidError:cu,TransactionExpiredTimeoutError:uu,TransactionInstruction:Iu,TransactionMessage:xu,TransactionStatus:Au,VALIDATOR_INFO_KEY:kh,VERSION_PREFIX_MASK:ou,VOTE_PROGRAM_ID:Sh,ValidatorInfo:Lh,VersionedMessage:Mu,VersionedTransaction:ku,VoteAccount:Ch,VoteAuthorizationLayout:Eh,VoteInit:Ah,VoteInstruction:Nh,VoteProgram:xh,clusterApiUrl:function(t,e){var n=!1===e?"http":"https";if(!t)return Ph[n].devnet;var r=Ph[n][t];if(!r)throw new Error("Unknown ".concat(n," cluster: ").concat(t));return r},sendAndConfirmRawTransaction:function(t,e,n,r){return _h.apply(this,arguments)},sendAndConfirmTransaction:_u})),Rh={};Object.defineProperty(Rh,"__esModule",{value:!0});var Uh={ERROR_ASSOCIATION_PORT_OUT_OF_RANGE:"ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",ERROR_FORBIDDEN_WALLET_BASE_URL:"ERROR_FORBIDDEN_WALLET_BASE_URL",ERROR_SECURE_CONTEXT_REQUIRED:"ERROR_SECURE_CONTEXT_REQUIRED",ERROR_SESSION_CLOSED:"ERROR_SESSION_CLOSED",ERROR_SESSION_TIMEOUT:"ERROR_SESSION_TIMEOUT",ERROR_WALLET_NOT_FOUND:"ERROR_WALLET_NOT_FOUND"},Qh=function(t){Y(n,t);var e=X(n);function n(){var t;B(this,n);for(var r=arguments.length,i=new Array(r),o=0;o=4294967296)throw new Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");var e=new ArrayBuffer(4);return new DataView(e).setUint32(0,t,!1),new Uint8Array(e)}function Hh(){return Wh(this,void 0,void 0,O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}function Gh(){return Wh(this,void 0,void 0,O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}var qh;function Zh(t,e){return Wh(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=JSON.stringify(t),i=Vh(t.id),o=new Uint8Array(12),crypto.getRandomValues(o),n.next=6,crypto.subtle.encrypt(Xh(i,o),e,(new TextEncoder).encode(r));case 6:return a=n.sent,(s=new Uint8Array(i.byteLength+o.byteLength+a.byteLength)).set(new Uint8Array(i),0),s.set(new Uint8Array(o),i.byteLength),s.set(new Uint8Array(a),i.byteLength+o.byteLength),n.abrupt("return",s);case 12:case"end":return n.stop()}}),n)})))}function Jh(t,e){return Wh(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s,u;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t.slice(0,4),i=t.slice(4,16),o=t.slice(16),n.next=5,crypto.subtle.decrypt(Xh(r,i),e,o);case 5:if(a=n.sent,s=Kh().decode(a),u=JSON.parse(s),!Object.hasOwnProperty.call(u,"error")){n.next=10;break}throw new Yh(u.id,u.error.code,u.error.message);case 10:return n.abrupt("return",u);case 11:case"end":return n.stop()}}),n)})))}function Xh(t,e){return{additionalData:t,iv:e,name:"AES-GCM",tagLength:128}}function Kh(){return void 0===qh&&(qh=new TextDecoder("utf-8")),qh}function $h(t,e,n){return Wh(this,void 0,void 0,O().mark((function r(){var i,o,a,s,u,c,l;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Promise.all([crypto.subtle.exportKey("raw",e),crypto.subtle.importKey("raw",t,{name:"ECDH",namedCurve:"P-256"},!1,[])]);case 2:return i=r.sent,o=tt(i,2),a=o[0],s=o[1],r.next=8,crypto.subtle.deriveBits({name:"ECDH",public:s},n,256);case 8:return u=r.sent,r.next=11,crypto.subtle.importKey("raw",u,"HKDF",!1,["deriveKey"]);case 11:return c=r.sent,r.next=14,crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(a),info:new Uint8Array},c,{name:"AES-GCM",length:128},!1,["encrypt","decrypt"]);case 14:return l=r.sent,r.abrupt("return",l);case 16:case"end":return r.stop()}}),r)})))}function td(t){if(t<49152||t>65535)throw new Qh(Uh.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE,"Association port number must be between 49152 and 65535. ".concat(t," given."),{port:t});return t}function ed(t){for(var e="",n=new Uint8Array(t),r=n.byteLength,i=0;i1?t.shift():t[0]}}(),u=1,c=0,l={__type:"disconnected"},n.abrupt("return",new Promise((function(e,n){var d,f,p,y={},m=function t(){return Wh(h,void 0,void 0,O().mark((function e(){var n,r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("connecting"===l.__type){e.next=3;break}return console.warn("Expected adapter state to be `connecting` at the moment the websocket opens. "+"Got `".concat(l.__type,"`.")),e.abrupt("return");case 3:return n=l.associationKeypair,d.removeEventListener("open",t),e.next=7,Gh();case 7:return r=e.sent,e.t0=d,e.next=11,Fh(r.publicKey,n.privateKey);case 11:e.t1=e.sent,e.t0.send.call(e.t0,e.t1),l={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:r.privateKey};case 14:case"end":return e.stop()}}),e)})))},g=function(t){t.wasClean?l={__type:"disconnected"}:n(new Qh(Uh.ERROR_SESSION_CLOSED,"The wallet session dropped unexpectedly (".concat(t.code,": ").concat(t.reason,")."),{closeEvent:t})),f()},v=function(t){return Wh(h,void 0,void 0,O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(f(),!(Date.now()-a>=ld)){t.next=5;break}n(new Qh(Uh.ERROR_SESSION_TIMEOUT,"Failed to connect to the wallet websocket on port ".concat(i,"."))),t.next=8;break;case 5:return t.next=7,new Promise((function(t){var e=s();p=window.setTimeout(t,e)}));case 7:b();case 8:case"end":return t.stop()}}),t)})))},w=function(r){return Wh(h,void 0,void 0,O().mark((function i(){var o,a,s,h,p,m,g,v;return O().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,r.data.arrayBuffer();case 2:o=i.sent,i.t0=l.__type,i.next="connected"===i.t0?6:"hello_req_sent"===i.t0?30:51;break;case 6:if(i.prev=6,a=o.slice(0,4),(s=new DataView(a).getUint32(0,!1))===c+1){i.next=11;break}throw new Error("Encrypted message has invalid sequence number");case 11:return c=s,i.next=14,Jh(o,l.sharedSecret);case 14:h=i.sent,p=y[h.id],delete y[h.id],p.resolve(h.result),i.next=29;break;case 20:if(i.prev=20,i.t1=i.catch(6),!(i.t1 instanceof Yh)){i.next=28;break}m=y[i.t1.jsonRpcMessageId],delete y[i.t1.jsonRpcMessageId],m.reject(i.t1),i.next=29;break;case 28:throw i.t1;case 29:return i.abrupt("break",51);case 30:return i.next=32,$h(o,l.associationPublicKey,l.ecdhPrivateKey);case 32:return g=i.sent,l={__type:"connected",sharedSecret:g},v=new Proxy({},{get:function(t,e){if(null==t[e]){var n=e.toString().replace(/[A-Z]/g,(function(t){return"_".concat(t.toLowerCase())})).toLowerCase();t[e]=function(t){return Wh(this,void 0,void 0,O().mark((function r(){var i;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=u++,r.t0=d,r.next=4,Zh({id:i,jsonrpc:"2.0",method:n,params:null!=t?t:{}},g);case 4:return r.t1=r.sent,r.t0.send.call(r.t0,r.t1),r.abrupt("return",new Promise((function(t,n){y[i]={resolve:function(r){switch(e){case"authorize":case"reauthorize":var i=r.wallet_uri_base;if(null!=i)try{dd(i)}catch(t){return void n(t)}}t(r)},reject:n}})));case 7:case"end":return r.stop()}}),r)})))}}return t[e]},defineProperty:function(){return!1},deleteProperty:function(){return!1}}),i.prev=35,i.t2=e,i.next=39,t(v);case 39:i.t3=i.sent,(0,i.t2)(i.t3),i.next=46;break;case 43:i.prev=43,i.t4=i.catch(35),n(i.t4);case 46:return i.prev=46,f(),d.close(),i.finish(46);case 50:return i.abrupt("break",51);case 51:case"end":return i.stop()}}),i,null,[[6,20],[35,43,46,50]])})))},b=function(){f&&f(),l={__type:"connecting",associationKeypair:r},void 0===a&&(a=Date.now()),(d=new WebSocket(o,["com.solana.mobilewalletadapter.v1"])).addEventListener("open",m),d.addEventListener("close",g),d.addEventListener("error",v),d.addEventListener("message",w),f=function(){window.clearTimeout(p),d.removeEventListener("open",m),d.removeEventListener("close",g),d.removeEventListener("error",v),d.removeEventListener("message",w)}};b()})));case 13:case"end":return n.stop()}}),n)})))};var fd=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n>>0,c=new Uint8Array(o);t[n];){var l=e[t.charCodeAt(n)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,n++}for(var f=o-i;f!==o&&0===c[f];)f++;for(var p=new Uint8Array(r+(o-f)),y=r;f!==o;)p[y++]=c[f++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var u=(o-i)*c+1>>>0,l=new Uint8Array(u);i!==o;){for(var h=e[i],d=0,f=u-1;(0!==h||d>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=u-r;p!==u&&0===l[p];)p++;for(var y=s.repeat(n);pthis.span)throw new RangeError("indeterminate span");return this.span}},{key:"replicate",value:function(t){var e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}},{key:"fromArray",value:function(t){}}]),t}();function xd(t,e){return e.property?t+"["+e.property+"]":t}Id.Layout=Ed,Id.nameWithProperty=xd,Id.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof Ed))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=function(){return new t},Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};var kd=function(t){Y(n,t);var e=X(n);function n(){return B(this,n),e.apply(this,arguments)}return U(n,[{key:"isCount",value:function(){throw new Error("ExternalLayout is abstract")}}]),n}(Ed),Td=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");return(i=e.call(this,-1,r)).elementSpan=t,i}return U(n,[{key:"isCount",value:function(){return!0}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.length-e;return Math.floor(n/this.elementSpan)}},{key:"encode",value:function(t,e,n){return 0}}]),n}(kd),Ld=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;if(B(this,n),!(t instanceof Ed))throw new TypeError("layout must be a Layout");if(void 0===r)r=0;else if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");return(o=e.call(this,t.span,i||t.property)).layout=t,o.offset=r,o}return U(n,[{key:"isCount",value:function(){return this.layout instanceof Sd||this.layout instanceof jd}},{key:"decode",value:function(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}]),n}(kd),Sd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readUIntLE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}]),n}(Ed),jd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readUIntBE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}]),n}(Ed),Cd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readIntLE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeIntLE(t,n,this.span),this.span}}]),n}(Ed),Dd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readIntBE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeIntBE(t,n,this.span),this.span}}]),n}(Ed),Od=Math.pow(2,32);function zd(t){var e=Math.floor(t/Od);return{hi32:e,lo32:t-e*Od}}function Pd(t,e){return t*Od+e}var _d=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.readUInt32LE(e);return Pd(t.readUInt32LE(e+4),n)}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=zd(t);return e.writeUInt32LE(r.lo32,n),e.writeUInt32LE(r.hi32,n+4),8}}]),n}(Ed),Bd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),Pd(t.readUInt32BE(e),t.readUInt32BE(e+4))}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=zd(t);return e.writeUInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}]),n}(Ed),Rd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.readUInt32LE(e);return Pd(t.readInt32LE(e+4),n)}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=zd(t);return e.writeUInt32LE(r.lo32,n),e.writeInt32LE(r.hi32,n+4),8}}]),n}(Ed),Ud=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),Pd(t.readInt32BE(e),t.readUInt32BE(e+4))}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=zd(t);return e.writeInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}]),n}(Ed),Qd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,4,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readFloatLE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeFloatLE(t,n),4}}]),n}(Ed),Yd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,4,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readFloatBE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeFloatBE(t,n),4}}]),n}(Ed),Wd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readDoubleLE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeDoubleLE(t,n),8}}]),n}(Ed),Fd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readDoubleBE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeDoubleBE(t,n),8}}]),n}(Ed),Vd=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;if(B(this,n),!(t instanceof Ed))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof kd&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var a=-1;return!(r instanceof kd)&&0u.span&&void 0===u.property)throw new Error("fields cannot contain unnamed variable-length layout")}}catch(t){s.e(t)}finally{s.f()}var c=-1;try{c=t.reduce((function(t,e){return t+e.getSpan()}),0)}catch(t){}return(o=e.call(this,c,r)).fields=t,o.decodePrefixes=!!i,o}return U(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0;try{n=this.fields.reduce((function(n,r){var i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n,r=this.makeDestinationObject(),i=st(this.fields);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(void 0!==o.property&&(r[o.property]=o.decode(t,e)),e+=o.getSpan(t,e),this.decodePrefixes&&t.length===e)break}}catch(t){i.e(t)}finally{i.f()}return r}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r,i=n,o=0,a=0,s=st(this.fields);try{for(s.s();!(r=s.n()).done;){var u=r.value,c=u.span;if(a=0c&&(c=u.getSpan(e,n)))}o=n,n+=c}}catch(t){s.e(t)}finally{s.f()}return o+a-i}},{key:"fromArray",value:function(t){var e,n=this.makeDestinationObject(),r=st(this.fields);try{for(r.s();!(e=r.n()).done;){var i=e.value;void 0!==i.property&&0i.span?n=-1:0<=n&&(n+=i.span)}}catch(t){r.e(t)}finally{r.f()}}}]),n}(Ed),Gd=function(){function t(e){B(this,t),this.property=e}return U(t,[{key:"decode",value:function(){throw new Error("UnionDiscriminator is abstract")}},{key:"encode",value:function(){throw new Error("UnionDiscriminator is abstract")}}]),t}(),qd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),!(t instanceof kd&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return(i=e.call(this,r||t.property||"variant")).layout=t,i}return U(n,[{key:"decode",value:function(t,e){return this.layout.decode(t,e)}},{key:"encode",value:function(t,e,n){return this.layout.encode(t,e,n)}}]),n}(Gd),Zd=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;B(this,n);var a=t instanceof Sd||t instanceof jd;if(a)t=new qd(new Ld(t));else if(t instanceof kd&&t.isCount())t=new qd(t);else if(!(t instanceof Gd))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===r&&(r=null),!(null===r||r instanceof Ed))throw new TypeError("defaultLayout must be null or a Layout");if(null!==r){if(0>r.span)throw new Error("defaultLayout must have constant span");void 0===r.property&&(r=r.replicate("content"))}var s=-1;r&&0<=(s=r.span)&&a&&(s+=t.layout.span),(o=e.call(this,s,i)).discriminator=t,o.usesPrefixDiscriminator=a,o.defaultLayout=r,o.registry={};var u=o.defaultGetSourceVariant.bind(Z(o));return o.getSourceVariant=function(t){return u(t)},o.configGetSourceVariant=function(t){u=t.bind(this)},o}return U(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}},{key:"defaultGetSourceVariant",value:function(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;var e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(var n in this.registry){var r=this.registry[n];if(t.hasOwnProperty(r.property))return r}throw new Error("unable to infer src variant")}},{key:"decode",value:function(t,e){var n;void 0===e&&(e=0);var r=this.discriminator,i=r.decode(t,e),o=this.registry[i];if(void 0===o){var a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),(n=this.makeDestinationObject())[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+a)}else n=o.decode(t,e);return n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=this.getSourceVariant(t);if(void 0===r){var i=this.discriminator,o=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=i.layout.span),i.encode(t[i.property],e,n),a+o.encode(t[o.property],e,n+a)}return r.encode(t,e,n)}},{key:"addVariant",value:function(t,e,n){var r=new Jd(this,t,e,n);return this.registry[t]=r,r}},{key:"getVariant",value:function(t,e){var n=t;return It.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}]),n}(Ed),Jd=function(t){Y(n,t);var e=X(n);function n(t,r,i,o){var a;if(B(this,n),!(t instanceof Zd))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof i&&void 0===o&&(o=i,i=null),i){if(!(i instanceof Ed))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=i.span&&i.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof o)throw new TypeError("variant must have a String property")}var s=t.span;return 0>t.span&&0<=(s=i?i.span:0)&&t.usesPrefixDiscriminator&&(s+=t.discriminator.layout.span),(a=e.call(this,s,o)).union=t,a.variant=r,a.layout=i||null,a}return U(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}},{key:"decode",value:function(t,e){var n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");var r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);var i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}},{key:"fromArray",value:function(t){if(this.layout)return this.layout.fromArray(t)}}]),n}(Ed);function Xd(t){return 0>t&&(t+=4294967296),t}var Kd=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;if(B(this,n),!(t instanceof Sd||t instanceof jd))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof r&&void 0===i&&(i=r,r=void 0),4=n)throw new TypeError("bits must be positive integer");var i=8*e.span,o=e.fields.reduce((function(t,e){return t+e.bits}),0);if(n+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=n,this.valueMask=(1<>>this.start}},{key:"encode",value:function(t){if(!Number.isInteger(t)||t!==Xd(t&this.valueMask))throw new TypeError(xd("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var e=this.container._packedGetValue(),n=Xd(t<n&&(n=this.length.decode(t,e)),n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}},{key:"encode",value:function(t,e,n){var r=this.length;if(this.length instanceof kd&&(r=t.length),!It.isBuffer(t)||r!==t.length)throw new TypeError(xd("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof kd&&this.length.encode(r,e,n),r}}]),n}(Ed),nf=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,-1,t)}return U(n,[{key:"getSpan",value:function(t,e){if(!It.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);for(var n=e;ne.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}]),n}(Ed),rf=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),"string"==typeof t&&void 0===r&&(r=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");return(i=e.call(this,-1,r)).maxSpan=t,i}return U(n,[{key:"getSpan",value:function(t,e){if(!It.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}},{key:"decode",value:function(t,e,n){void 0===e&&(e=0);var r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}]),n}(Ed),of=function(t){Y(n,t);var e=X(n);function n(t,r){var i;return B(this,n),(i=e.call(this,0,r)).value=t,i}return U(n,[{key:"decode",value:function(t,e,n){return this.value}},{key:"encode",value:function(t,e,n){return 0}}]),n}(Ed);Id.ExternalLayout=kd,Id.GreedyCount=Td,Id.OffsetLayout=Ld,Id.UInt=Sd,Id.UIntBE=jd,Id.Int=Cd,Id.IntBE=Dd,Id.Float=Qd,Id.FloatBE=Yd,Id.Double=Wd,Id.DoubleBE=Fd,Id.Sequence=Vd,Id.Structure=Hd,Id.UnionDiscriminator=Gd,Id.UnionLayoutDiscriminator=qd,Id.Union=Zd,Id.VariantLayout=Jd,Id.BitStructure=Kd,Id.BitField=$d,Id.Boolean=tf,Id.Blob=ef,Id.CString=nf,Id.UTF8=rf,Id.Constant=of,Id.greedy=function(t,e){return new Td(t,e)},Id.offset=function(t,e,n){return new Ld(t,e,n)},Id.u8=function(t){return new Sd(1,t)},Id.u16=function(t){return new Sd(2,t)},Id.u24=function(t){return new Sd(3,t)},Id.u32=function(t){return new Sd(4,t)},Id.u40=function(t){return new Sd(5,t)},Id.u48=function(t){return new Sd(6,t)},Id.nu64=function(t){return new _d(t)},Id.u16be=function(t){return new jd(2,t)},Id.u24be=function(t){return new jd(3,t)},Id.u32be=function(t){return new jd(4,t)},Id.u40be=function(t){return new jd(5,t)},Id.u48be=function(t){return new jd(6,t)},Id.nu64be=function(t){return new Bd(t)},Id.s8=function(t){return new Cd(1,t)},Id.s16=function(t){return new Cd(2,t)},Id.s24=function(t){return new Cd(3,t)},Id.s32=function(t){return new Cd(4,t)},Id.s40=function(t){return new Cd(5,t)},Id.s48=function(t){return new Cd(6,t)},Id.ns64=function(t){return new Rd(t)},Id.s16be=function(t){return new Dd(2,t)},Id.s24be=function(t){return new Dd(3,t)},Id.s32be=function(t){return new Dd(4,t)},Id.s40be=function(t){return new Dd(5,t)},Id.s48be=function(t){return new Dd(6,t)},Id.ns64be=function(t){return new Ud(t)},Id.f32=function(t){return new Qd(t)},Id.f32be=function(t){return new Yd(t)},Id.f64=function(t){return new Wd(t)},Id.f64be=function(t){return new Fd(t)},Id.struct=function(t,e,n){return new Hd(t,e,n)},Id.bits=function(t,e,n){return new Kd(t,e,n)};var af=Id.seq=function(t,e,n){return new Vd(t,e,n)};Id.union=function(t,e,n){return new Zd(t,e,n)},Id.unionLayoutDiscriminator=function(t,e){return new qd(t,e)},Id.blob=function(t,e){return new ef(t,e)},Id.cstr=function(t){return new nf(t)},Id.utf8=function(t,e){return new rf(t,e)},Id.const=function(t,e){return new of(t,e)};var sf={},uf={exports:{}};!function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"===z(t)?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:cr.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"===z(t))return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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];i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.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;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 I(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){I.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return v[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,I),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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,L)}(uf),function(t){var e=L&&L.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;var n=Id,r=Bh,i=e(uf.exports),o=Id;Object.defineProperty(t,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(t,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(t,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(t,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(t,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(t,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(t,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(t,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return o.struct}});var a=function(t){Y(r,t);var e=X(r);function r(t,i,o){var a;return B(this,r),(a=e.call(this,t,o)).blob=n.blob(t),a.signed=i,a}return U(r,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new i.default(this.blob.decode(t,e),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.signed&&(t=t.toTwos(8*this.span)),this.blob.encode(t.toArrayLike(It,"le",this.span),e,n)}}]),r}(n.Layout);function s(t){return new a(8,!1,t)}t.u64=s,t.i64=function(t){return new a(8,!0,t)},t.u128=function(t){return new a(16,!1,t)},t.i128=function(t){return new a(16,!0,t)};var u=function(t){Y(n,t);var e=X(n);function n(t,r,i,o){var a;return B(this,n),(a=e.call(this,t.span,o)).layout=t,a.decoder=r,a.encoder=i,a}return U(n,[{key:"decode",value:function(t,e){return this.decoder(this.layout.decode(t,e))}},{key:"encode",value:function(t,e,n){return this.layout.encode(this.encoder(t),e,n)}},{key:"getSpan",value:function(t,e){return this.layout.getSpan(t,e)}}]),n}(n.Layout);t.publicKey=function(t){return new u(n.blob(32),(function(t){return new r.PublicKey(t)}),(function(t){return t.toBuffer()}),t)};var c=function(t){Y(r,t);var e=X(r);function r(t,i){var o;return B(this,r),(o=e.call(this,-1,i)).layout=t,o.discriminator=n.u8(),o}return U(r,[{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==t?this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+1)+1)}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+1);throw new Error("Invalid option "+this.property)}},{key:"getSpan",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(t,e);if(0===n)return 1;if(1===n)return this.layout.getSpan(t,e+1)+1;throw new Error("Invalid option "+this.property)}}]),r}(n.Layout);function l(t){if(0===t)return!1;if(1===t)return!0;throw new Error("Invalid bool: "+t)}function h(t){return t?1:0}function d(t){var e=n.u32("length"),r=n.struct([e,n.blob(n.offset(e,-e.span),"data")]);return new u(r,(function(t){return t.data}),(function(t){return{data:t}}),t)}t.option=function(t,e){return new c(t,e)},t.bool=function(t){return new u(n.u8(),l,h,t)},t.vec=function(t,e){var r=n.u32("length"),i=n.struct([r,n.seq(t,n.offset(r,-r.span),"values")]);return new u(i,(function(t){return t.values}),(function(t){return{values:t}}),e)},t.tagged=function(t,e,r){var i=n.struct([s("tag"),e.replicate("data")]);return new u(i,(function(e){var n=e.tag,r=e.data;if(!n.eq(t))throw new Error("Invalid tag, expected: "+t.toString("hex")+", got: "+n.toString("hex"));return r}),(function(e){return{tag:t,data:e}}),r)},t.vecU8=d,t.str=function(t){return new u(d(),(function(t){return t.toString("utf-8")}),(function(t){return It.from(t,"utf-8")}),t)},t.rustEnum=function(t,e,r){var i=n.union(null!=r?r:n.u8(),e);return t.forEach((function(t,e){return i.addVariant(e,t,t.property)})),i},t.array=function(t,e,r){var i=n.struct([n.seq(t,e,"values")]);return new u(i,(function(t){return t.values}),(function(t){return{values:t}}),r)};var f=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;return B(this,n),(o=e.call(this,t.span+r.span,i)).keyLayout=t,o.valueLayout=r,o}return U(n,[{key:"decode",value:function(t,e){return e=e||0,[this.keyLayout.decode(t,e),this.valueLayout.decode(t,e+this.keyLayout.getSpan(t,e))]}},{key:"encode",value:function(t,e,n){n=n||0;var r=this.keyLayout.encode(t[0],e,n);return r+this.valueLayout.encode(t[1],e,n+r)}},{key:"getSpan",value:function(t,e){return this.keyLayout.getSpan(t,e)+this.valueLayout.getSpan(t,e)}}]),n}(n.Layout);t.map=function(t,e,r){var i=n.u32("length"),o=n.struct([i,n.seq(new f(t,e),n.offset(i,-i.span),"values")]);return new u(o,(function(t){var e=t.values;return new Map(e)}),(function(t){return{values:Array.from(t.entries())}}),r)}}(sf),ut.Web3MobileWallet;var cf=ut.transact,lf=cr.Buffer,hf=Mr.exports,df=sf.struct([sf.publicKey("mint"),sf.publicKey("owner"),sf.u64("amount"),sf.u32("delegateOption"),sf.publicKey("delegate"),sf.u8("state"),sf.u32("isNativeOption"),sf.u64("isNative"),sf.u64("delegatedAmount"),sf.u32("closeAuthorityOption"),sf.publicKey("closeAuthority")]);sf.array;var ff=sf.bool,pf=sf.i128;sf.i16;var yf=sf.i32,mf=sf.i64;sf.i8,sf.map;var gf=sf.option,vf=sf.publicKey,wf=sf.rustEnum,bf=sf.str,Mf=sf.struct;sf.tagged;var Af=sf.u128,Nf=sf.u16,If=sf.u32,Ef=sf.u64,xf=sf.u8,kf=sf.vec;sf.vecU8;const Tf="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yOTkuMyAyMzcuNSA1MDAgMTIybDIwMC43IDExNS41LTczLjUgNDIuNkw1MDAgMjA4LjJsLTEyNy4xIDcxLjktNzMuNi00Mi42em00MDEuNCAxNDYtNzMuNS00Mi42LTEyNy4xIDczTDM3MyAzNDAuNGwtNzMuNSA0My4xdjg1LjdsMTI3LjEgNzN2MTQ1LjRsNzMuNSA0My4xIDczLjUtNDMuMVY1NDIuMWwxMjcuMS03M3YtODUuNnptMCAyMzIuMXYtODUuN2wtNzMuNSA0Mi42djg1LjdjLS4xLS42IDczLjUtNDIuNiA3My41LTQyLjZ6bTUxLjkgMjkuMy0xMjcuMSA3M3Y4NS43TDgyNi4xIDY4OFY0NTYuNGwtNzMuNSA0My4xdjE0NS40em0tNzMuNS0zMzQuNCA3My41IDQzLjF2ODUuN2w3My41LTQzLjF2LTg1LjdsLTczLjUtNDMuMS03My41IDQzLjF6TTQyNi41IDc0OS40djg1LjdsNzMuNSA0My4xIDczLjUtNDMuMXYtODUuN2wtNzMuNSA0Mi03My41LTQyek0yOTkuMyA2MTUuNmw3My41IDQzLjF2LTg2LjJMMjk5LjMgNTMwdjg1LjZ6bTEyNy4yLTMwNS4xIDczLjUgNDMuMSA3My41LTQzLjEtNzMuNS00Mi42YzAtLjUtNzMuNSA0Mi42LTczLjUgNDIuNnptLTE3OS4xIDQzLjEgNzMuNS00My4xLTczLjUtNDMuMS03My41IDQzLjF2ODUuN2w3My41IDQzLjF2LTg1Ljd6bTAgMTQ1LjQtNzMuNS00Mi42VjY4OGwyMDAuNyAxMTUuNXYtODUuN2wtMTI3LjEtNzNjLS4xLjEtLjEtMTQ1LjgtLjEtMTQ1Ljh6IiBmaWxsPSIjZjBiOTBiIi8+PC9zdmc+",Lf="https://app.uniswap.org/static/media/bnb-logo.797868eb94521320b78e3967134febbe.svg";var Sf={name:"bsc",id:"0x38",networkId:"56",namespace:"eip155",platform:"evm",label:"BNB Smart Chain",fullName:"BNB Smart Chain Mainnet",logo:Tf,logoBackgroundColor:"#000000",logoWhiteBackground:Tf,currency:{name:"BNB",symbol:"BNB",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Lf},wrapped:{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png"},stables:{usd:["0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d","0x55d398326f99059fF775485246999027B3197955"]},explorer:"https://bscscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://bscscan.com/tx/${t.id||t}`:e?`https://bscscan.com/token/${e}`:n?`https://bscscan.com/address/${n}`:void 0,endpoints:["https://bsc-dataseed.binance.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed3.defibit.io"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"BNB",name:"Binance Coin",decimals:18,logo:Lf,type:"NATIVE"},{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",symbol:"WBNB",name:"Wrapped BNB",decimals:18,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png",type:"20"},{address:"0x55d398326f99059fF775485246999027B3197955",symbol:"USDT",name:"Tether USD",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x55d398326f99059fF775485246999027B3197955/logo.png",type:"20"},{address:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",symbol:"USDC",name:"USD Coin",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d/logo.png",type:"20"},{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:"ETH",name:"Ethereum Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x2170Ed0880ac9A755fd29B2688956BD959F933F8/logo.png",type:"20"},{address:"0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",symbol:"Cake",name:"PancakeSwap Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82/logo.png",type:"20"},{address:"0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",symbol:"BTCB",name:"BTCB Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const jf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAADxdJREFUeJztXVtzFMcVplwuP8VVeYmf7HJ+RKqSl/AQP6X8H+yqXUEIjhMnQY5jO9oVCIzA5mowdzAYG4xAGAyWLC5G3IyDL8gOASUYKrarYGZWC7qi23b6692VV6uZ7e6ZnT3di07VV6JUaLfnnG+6z+lz+vScOXUoL6SzP52/2PtlQ9p7piHlLU2k3P2JJqcjkXLO8589/OdN/tPjvx8VEP8Wv+sp/J8O/A3+Fp+Bz8JnUj/XrPjIwjT7ybxm57fJlLsy2eR2cwPe4QZksYB/Nr4D34XvxHdTP/8DJ+k0e4S/lb9Jpr2WZJNzgRtjPDaDS4DvFmPgY8GYMDZq/dStNKQzv0qmnA1c6RkqgysQIoMxYqzU+qoLWZDO/jyZdl7lir1ObdwQZLiOseMZqPVonSTS7i+4AtsTTW6O2pDR4ebEs/Bnotar8dKw2Pk1n0I76Y0W16zgdOIZqfVsnCSbvaeEB2+AkWpCBEQS/Jmp9U4u3Fl6nIdWB6gNQgb+7NABtR1qLjxcejiZdhfxKXGA3AjUswHXAXQBnVDbpSbCPeO5fAr8hlrxpgE6gW6o7ROb5N96Z3l9ePZxgUcMXEd1NxssbMk8kWxyztEr2A5AV3XjGySb3acTSLYYoFjL4EF31PYLLXwaeyiZcltnp/woEJtIrdAltT21BEkR7tnuo1dgfQC6tCbRlGh1H02k3C5qpalg/bt3WdOGDPk4lACdct1S27eiLEgPPMbDmcvkylLAgiUOc/sm2LHuITavmX48KoBun1828DNqO/tKsiX7JF+zeqmVpIqPzg2xyckc++Sfw2ImoB6POtxe6Jra3tMEb75Nxv/Hmxk2MZGbIsCpz4bZn1d45OPSIQF0Tm13IViXbJn2i+i9NcYgRQIA+zsGyMelA6Fzap8AnqktDl8RO9r7WVFKCQAs3dJHPj4tcN2TRQcizrcs1Hv+NZf1D04GEqDj/JBwDqnHqYNCiFj7fYL8Jg+9AnTQfXmYlUo5AYAtbffIx6lNAm6L2hpfbO/atcO3dGsfy+VyUgIAL66yySEE3FzNto2R2ElYtrffkHbYd7fHWbkEEeDQyUHk6cnHrQkPtonV+CKla2FWDx6+nwQRAFi5K0s+bl3ANrGmkvP5fPoH1cFfX/fYyP2cNgG6Lg6z55a55OPXJgG3UVzGn2vbug98fvW+r/FlBADePtJPPn59iKKS6lYW5ad++8q4Vu+5G2h8FQIAr663JFlUAtiqqksBZ1Uj9UPp4neLHeb0TUQmwNEzg2xemv559OE2VsX4KE2ysXoXhpOJCgGAdXttShblAZtVpayMe5Zt1A+ji5fXZdj4uL/jF4YApy4NsxdaLXQIue2iGb/Ze4r6IcLg6rejUuPrEAB47yO7kkVTJIhyAsnG41rYylUVHQIAizdZlixqyh9DC2V8HGKkHrwuELffHZiUWz4kAVBEAueS+jl1EepAqo2ndLFW64guAYBNB2xMFjmdWsbHWXbqQesC0zMMGjcBgEVv2JYs4tDpT5BvzmDAoBWBxM2tH8a0jB+FAAe77EsWwaZKxkdLE9u2fPce65dbu4oEAFp32JYscnNK7WrQ14Z+sOpAMefwiLrjVy0CdF0cYguX2rU3ANtKCWBTdS9wqWcklPGjEgDYcdiuZBEaV1U0PtqbUQ9SB6/vyoY2fjUIALy81q5kUcUWduhxRz1AVcxvdthtb2aVT60JcOT0oKg4otaHKmBjX+OLA50GN2Esx+FT8mRPLQgAIO1MrQ91ArgZ31JytDqlHpwqXlrjsbExvZg/TgKcvDTM/rjcHocQtp45/ae9FuqBqeLr/6gle2pFAAChKLVeVAFbzyRAk3OBemAq2LhfPdlTSwIA6Y12JItg62nGR9tzyq7bqljY4rK+e5WrfCgJcPzskHBOqfUkJQC39bRW9+h9Tz0oFXx8Yahqxo+DAMCGfXY4hLB5SfjnrqQekAypjRntZA8FAU5/NixK0an1JQNsXrL+m1/4ceM7/WRPJcExsas3Rtn7nQNVJ8GBj82vHppWKBLrNStVAOrzqyWjPHzEWQGEbjBW81t9bPn2LNt9tF/UE1SLBMu2Ge4QcpsL4+MyJPLBVADi68HhcMmeUrnbP8kufDUyw8ggQBHoD7Dt4D3WyX2NqASAv/L7Fnr9VYK4CAs3YlEPpBLOfxk+2QP5wRlnZy7ztTnAUKUEKGLJpj72JnfmUFoehQTbDpldPQTb8/Xfe5Z6IEHA1BxWem+N8rdd/ib7EaAUq/dkxZoelgTYtaTWYxBwJR7y/8uoB+IHnMbB26sjY+M59uU1vr5/qj6FywhQxIodWfbOh/2ioZQOAZCzMLV6CLafU7hUkXww5Wjr8j/S7Sdo+3LxyojSGx+WAFN+wtY+tp1P7V0afsIbbxtaPcRtb2T1b+Mqj90flcf8t91x1v158PoeBwGKWLy5j23kfsIxBT/h5KfDoj8RtV7LIaqFTcwBfHUt+Eg35L//G2WnqxSyhSVAKdZwP+FgV2U/Yc9R85JFIieQwH25BgymCHTt9JPxiRy7ch3xe/QQrdoEKGLlzqzICgb5CQb2Je6ZU7g0mXogAmjR5mWnJ3uwB3Dp65nxu4kEKGIZ9xN2tN9jJy5OJ6txfYm57TEDGNPwCdm0otzJTLCzX+T31uMwfJwEmNpP2NLHNu2/y453/0gEw/oSe3MK16dTD2Sqf+/N78diN3qtCDDlMG7qY2v33mWHTg6Y1ZeY294YAhw7Ozi1P19L1IIA0/yEXdxpfMeQWUAQwJAlAClUtHOrdwL8fW3GpBPGnlFOIIDp8lh3dT19EwiAJe4PprWdKziBRoWBALaB1/JpEhsothMAdYJY8w3dDhZh4HkDBuIL7J7t+qDfWgKg57BRYV85uO0xA3SQD0SCl9ZkRP9eWwjwyrqM8bUABXQYkwySpU0xhb62Lcs6z5u7E4idPpUDIn8ypeOYSAYZkg5esTPLPr0yIu2+gd1CnA3QTcvGSYA0B6IY2TpfXNLQxo5a30BDyluKI2HPUA+kCHj/qNlDDl0WKsGxevd49LAxqvGxPM2XjBV+AJpNYp/DpJ1AURBiUkkYvP9i9S9yAnjTZX+DaffoJ+H9g7CGR1j3nEKDCIS12OLGd6HGwaRoQJSEmVYU+rfVHhu+/2MR6LWbo+JMQGUmO6Lo4kSIsDFMWKfSNRRLWWnJOdrPm3aAVBSFmlgWXt7sEQc4kB+QKRBv5Pb2e7ERAIUqssbROL629eDMMSzZbFiZeLEs3NSDISjhLpeh4Umx7ssaMiD+bpMUaOgQAE6b7DYxjAkdS7ouzoxScFUdtT7LMe1giIlHw/AmORn/g6AoFlWps0OdP7p7hiUA/AuVUi74A+gU4vf5KC2XOYkkBCg9Gmbq4VBMm0gRBwkqgGX7B1A+PO+ggpKgsO4vK+VhHXwBVAAFkQuhqqk3kE07HGry8XDU5FcStIWHl40Zo9LnwH9AXZ6MAHBCZUe8EaLiFLBsL2LVbjOrgWccDze5QQTeQpX27zj6tV3hJM4r6zPsg5Lpemr7lv9eRiIA5V4dCruR+wxuLz+jQYTpLWIwHQ8MqZ0P/Pb7MdYiuQMYpMLOI87vIcRU2ZrFUnPwhNp+A7arTb5xzLdFjOlNorCTpio4+o0zhSBOpc+EZy+LKJDD33lYLyNpYPXvNPg2ibKhTRzqA3QE9wUiHAzTtgXx/po9+jUJpreTD2wTlw8HzW4UCY/e7wpYmSCc1NmDRxQQpioJOQzTbxgLbBSZXwbMbxWLmDtsj8B/3RiteA8gMnr7QtYlItEjW3JMQMVWsflZwL1OPUgZEM6FFWwrI2dQWp+H4o3NB/S2kMuBo+zUepFB2ixaEMCSdvFf/Lvy+UGZIKpAW5hiNBDF+Cae+/MlgEq7eFsujMAWbdSegdXoEoZNKFmewAwoXhhRWAasuDIGTRuitI57kNrFK18ZA7Hp0qgPz4RvHhmVACZV90ihc2lUfhYwr3GEHxrS4XsIRiEAchQmVfdUgva1cRCbLo58sayKKG4CIOdvWnVPxZckzMWRYhYwsFAkCDpXxkYlgHHVPRUQ+upYQQDLLo/W7SkYhgAoOaN+Ti0CRLk8GpJIOQeoH0IVSOfeCagiqgYBUH1sYnVPILjtIhkf0pDOPM6diAHyh1EEpufxClVEYQmA4o9Gi66Mhc1gu8gEgCTT7iLqB9KBrIooDAGM7fUXRABus6oYH5JOs4e5M/EN9UNpsF+0gq8WAd4zuLrH9/m5rWCzqhEAkkw7c23YIi4CmTl0EI1KAFHdY9UVsW4Otqqq8UtIsJz+AdWBJhNRCYD0M/Vz6AA2isX4kPxS4JyjfkgdVKoikhHgrfctC/m4bao+9ZfLwpbMEwlDGkupoFIVUSUCtJ80v7qnDB5sE6vxi5Jsdp+2yR9AFdCoTxVREAEwaxjTy08JfN3nNqmJ8adIkHJb6R9cHbt9qoiCCIBOJNTj1QFsUVPjQ/ha8xCPNfdRP7wOcFmUjAC7j9hR3TNlfG4D2KLmBCiQ4JFEyu2iVoIqyquIyglgT3VPAVz3gSXetZJEq/tossm9TK4MRbSWVBGVEwDtXqjHpwqhc657UuMXZUF64DHuiPRSK0UVOLJdTgCcPKIelzrcXuic2u7TJNmSfdIWEhSriIoEsKm6BzqGrqnt7StgpS3LAc7to+MIqntMvM/HD9CtcW9+uWBdssUxxDk+dPGiHocSoFNT1nyZiIOmloWIJqMQ6tF6+7oi9gnEZpE9O4bmwc1Bh2RxfjUkv21sT+7AIHg1396NS5CksC2LSAnoqmaJnVqJSCWLeoLZJSEYophjeewpXUpBtYpN5WW1AnQSWyWPaQKGc7Y32lRtHJvhhQ7cxrp+64NElJw3OW3URqB76522qpVu2yw4vWLTMbTohne7I5/YqUfBIUZbTiWHMjx/ttAHNR8kwVn2fJOKeogYxGZOu/b5/FnJt6vJ9yyyI8tYZvhejF25LcusVBa0N0OPO5ObWWJsGKO0FdushBckRdDqFP1u0fSYsss5vluMgY8FY7IuYVMPgrbn6H2PCxBEJBHn9Tf8s4UHz78L3zmj5fqsmCG4DAk3YiWbvGfFvYgpdz888EJL/J7Chdkerk8XEP8Wv+vJzyo8EsHf8L/FZ+Czpi5YqjP5P2ey0rAsl+yGAAAAAElFTkSuQmCC",Cf="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png";var Df={name:"ethereum",id:"0x1",networkId:"1",namespace:"eip155",platform:"evm",label:"Ethereum",fullName:"Ethereum Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbC1vcGFjaXR5Oi42MDJ9LnN0MCwuc3Qxe2ZpbGw6I2ZmZn08L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik01MTEuNCA3My4zdjMxNS41TDc3OCA1MDggNTExLjQgNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNTExLjQgNzMuMyAyNDQuNyA1MDhsMjY2LjYtMTE5LjJWNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNNTExLjQgNzEyLjN2MjE0LjVsMjY2LjgtMzY5LjEtMjY2LjggMTU0LjZ6Ii8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTUxMS40IDkyNi43VjcxMi4zTDI0NC43IDU1Ny42bDI2Ni43IDM2OS4xeiIvPjxwYXRoIGQ9Ik01MTEuNCA2NjIuNyA3NzggNTA4IDUxMS40IDM4OC44djI3My45eiIgZmlsbD0iI2ZmZiIgZmlsbC1vcGFjaXR5PSIuMiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im0yNDQuNyA1MDggMjY2LjYgMTU0LjdWMzg4LjhMMjQ0LjcgNTA4eiIvPjwvc3ZnPgo=",logoBackgroundColor:"#5683ec",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGltYWdlLXJlbmRlcmluZz0ib3B0aW1pemVRdWFsaXR5IiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgdGV4dC1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4PSIwIiB5PSIwIiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGU+LnN0MXtmaWxsOiM4YzhjOGN9PC9zdHlsZT48cGF0aCBkPSJtNDk5LjggNzcuNS01LjUgMTl2NTU5LjFsNS41IDUuNSAyNTkuNy0xNTMuNUw0OTkuOCA3Ny41eiIgZmlsbD0iIzM0MzQzNCIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Im00OTkuOCA3Ny41LTI1OS4zIDQzMEw0OTkuOCA2NjFWNzcuNXoiLz48cGF0aCBkPSJtNDk5LjggNzEwLjMtMi45IDR2MTk5LjFsMi45IDkuMSAyNTkuNy0zNjUuOC0yNTkuNyAxNTMuNnoiIGZpbGw9IiMzYzNjM2IiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNDk5LjggOTIyLjVWNzEwLjNMMjQwLjUgNTU2LjdsMjU5LjMgMzY1Ljh6Ii8+PHBhdGggZD0ibTQ5OS44IDY2MSAyNTkuNy0xNTMuNS0yNTkuNy0xMTcuOFY2NjF6IiBmaWxsPSIjMTQxNDE0Ii8+PHBhdGggZD0iTTI0MC41IDUwNy41IDQ5OS44IDY2MVYzODkuN0wyNDAuNSA1MDcuNXoiIGZpbGw9IiMzOTM5MzkiLz48L3N2Zz4K",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:jf},wrapped:{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",logo:Cf,logoBackgroundColor:"#FFFFFF"},stables:{usd:["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]},explorer:"https://etherscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://etherscan.io/tx/${t.id||t}`:e?`https://etherscan.io/token/${e}`:n?`https://etherscan.io/address/${n}`:void 0,endpoints:["https://rpc.ankr.com/eth","https://eth.llamarpc.com","https://ethereum.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:jf,type:"NATIVE"},{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:Cf,type:"20"},{address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c/logo.png",type:"20"},{address:"0xdAC17F958D2ee523a2206206994597C13D831ec7",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x6B175474E89094C44Da98b954EedeAC495271d0F",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x853d955aCEf822Db058eb8505911ED77F175b99e",symbol:"FRAX",name:"Frax",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x853d955aCEf822Db058eb8505911ED77F175b99e/logo.png",type:"20"},{address:"0x956F47F50A910163D8BF957Cf5846D573E7f87CA",symbol:"FEI",name:"Fei USD",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x956F47F50A910163D8BF957Cf5846D573E7f87CA/logo.png",type:"20"},{address:"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Of="https://assets.spooky.fi/tokens/FTM.png",zf="https://assets.spooky.fi/tokens/wFTM.png";var Pf={name:"fantom",id:"0xfa",networkId:"250",namespace:"eip155",label:"Fantom",fullName:"Fantom Opera",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00NjcgMTM1LjVjMTgtOS4zIDQ1LjEtOS4zIDYzIDBsMTgzLjQgOTdjMTAuNyA2LjEgMTYuNiAxNCAxOCAyMy4zdjQ4Ni42YzAgOS4zLTYuMSAxOS4yLTE4IDI1LjJsLTE4My4yIDk3Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTgzLjMtOTdjLTExLjktNi4xLTE3LjItMTUuOS0xOC0yNS4yVjI1NS43Yy43LTguNyA2LjctMTcuMiAxNy4yLTIzLjNMNDY3IDEzNS41em0yMzUuOCAzODkuNy0xNzIuNiA5MC45Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTcxLjktOTAuM3YyMTQuNGwxNzEuOSA5MC4zYzEwIDUuMyAyMC42IDEwLjcgMzEuMiAxMS4zaC43YzEwIDAgMjAtNS4zIDMwLjUtMTBsMTc0LTkyLjMtLjgtMjE0LjN6TTIzNy4zIDczMS4xYzAgMTguNiAyIDMxLjIgNi43IDM5LjggMy4zIDcuMyA4LjcgMTIuNiAxOC42IDE5LjJsLjcuN2MyIDEuNCA0LjcgMi42IDcuMyA0LjdsMy4zIDIgMTAuNyA2LjEtMTQuNiAyNC42LTExLjMtNy4zLTItMS40Yy0zLjMtMi02LjEtNC04LjctNS4zLTI3LjktMTguNi0zNy44LTM5LjItMzcuOC04MS42di0xLjRoMjcuMXpNNDg1IDM5Ni40Yy0xLjQuNy0yLjYuNy00IDEuNGwtMTgzLjIgOTYuOWgtLjcuN2wxODMuMyA5N2MxLjQuNyAyLjYgMS40IDQgMS40bC0uMS0xOTYuN3ptMjkuMyAwdjE5Ny44YzEuNC0uNyAyLjYtLjcgNC0xLjRsMTgzLjMtOTdoLjctLjdsLTE4My4zLTk4LjJjLTEuNC0uNS0yLjgtMS4yLTQtMS4yem0xODguNS0xMDctMTY0LjcgODYuMyAxNjQuNyA4Ni40VjI4OS40em0tNDA3LjcgMHYxNzMuM2wxNjQuNy04Ni4zLTE2NC43LTg3em0yMjIuNS0xMjhjLTkuMy01LjMtMjYuNS01LjMtMzYuNiAwbC0xODMuMiA5N2gtLjcuN2wxODMuMyA5N2M5LjMgNS4zIDI2LjUgNS4zIDM2LjYgMGwxODMuMy05N2guNy0uN2wtMTgzLjQtOTd6bTIxMi41IDkuMyAxMS4zIDcuMyAyIDEuNGMzLjMgMiA2LjEgNCA4LjcgNS4zIDI3LjkgMTguNiAzNy44IDM5LjIgMzcuOCA4MS42djEuNGgtMjguN2MwLTE4LjYtMi0zMS4yLTYuNy0zOS44LTMuMy03LjMtOC43LTEyLjYtMTguNi0xOS4ybC0uNy0uN2MtMi0xLjQtNC43LTIuNi03LjMtNC43bC0zLjMtMi0xMC43LTYuMSAxNi4yLTI0LjV6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#226efb",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iNDI1IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE5NjlmZiIvPjxwYXRoIGQ9Ik00NzQuMSAyMTAuM2MxNC4zLTcuNCAzNS45LTcuNCA1MC4yIDBsMTQ1LjkgNzcuMmM4LjUgNC44IDEzLjIgMTEuMSAxNC4zIDE4LjV2Mzg3LjVjMCA3LjQtNC44IDE1LjMtMTQuMyAyMC4xbC0xNDUuOSA3Ny4yYy0xNC4zIDcuNC0zNS45IDcuNC01MC4yIDBsLTE0NS45LTc3LjJjLTkuNS00LjgtMTMuNy0xMi43LTE0LjMtMjAuMVYzMDZjLjUtNi45IDUuMy0xMy43IDEzLjctMTguNS4xIDAgMTQ2LjUtNzcuMiAxNDYuNS03Ny4yem0xODcuNyAzMTAuM0w1MjQuMyA1OTNjLTE0LjMgNy40LTM1LjkgNy40LTUwLjIgMGwtMTM2LjktNzEuOXYxNzAuN2wxMzYuOSA3MS45YzcuOSA0LjIgMTYuNCA4LjUgMjQuOCA5aC41YzcuOSAwIDE1LjktNC4yIDI0LjMtNy45bDEzOC41LTczLjVWNTIwLjZoLS40ek0yOTEuMiA2ODQuNWMwIDE0LjggMS42IDI0LjggNS4zIDMxLjcgMi42IDUuOCA2LjkgMTAgMTQuOCAxNS4zbC41LjVjMS42IDEuMSAzLjcgMi4xIDUuOCAzLjdsMi42IDEuNiA4LjUgNC44LTExLjYgMTkuNi05LTUuOC0xLjYtMS4xYy0yLjYtMS42LTQuOC0zLjItNi45LTQuMi0yMi4yLTE0LjgtMzAuMS0zMS4yLTMwLjEtNjV2LTEuMWgyMS43em0xOTcuMi0yNjYuNGMtMS4xLjUtMi4xLjUtMy4yIDEuMWwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzEuMS41IDIuMSAxLjEgMy4yIDEuMVY0MTguMXptMjMuMiAwdjE1Ny41YzEuMS0uNSAyLjEtLjUgMy4yLTEuMWwxNDUuOS03Ny4yaC41LS41bC0xNDUuOS03OC4yYy0xLjEtLjUtMi4xLTEtMy4yLTF6TTY2MS44IDMzM2wtMTMxLjEgNjguNyAxMzEuMSA2OC43VjMzM3ptLTMyNC42IDB2MTM4bDEzMS4xLTY4LjdjMC0uMS0xMzEuMS02OS4zLTEzMS4xLTY5LjN6bTE3Ny4xLTEwMi4xYy03LjQtNC4yLTIxLjEtNC4yLTI5LjEgMGwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzcuNCA0LjIgMjEuMSA0LjIgMjkuMSAwbDE0NS45LTc3LjJoLjUtLjVsLTE0NS45LTc3LjJ6bTE2OS4xIDcuNCA5IDUuOCAxLjYgMS4xYzIuNiAxLjYgNC44IDMuMiA2LjkgNC4yIDIyLjIgMTQuOCAzMC4xIDMxLjIgMzAuMSA2NXYxLjFoLTIyLjdjMC0xNC44LTEuNi0yNC44LTUuMy0zMS43LTIuNi01LjgtNi45LTEwLTE0LjgtMTUuM2wtLjUtLjVjLTEuNi0xLjEtMy43LTIuMS01LjgtMy43bC0yLjYtMS42LTguNS00LjggMTIuNi0xOS42eiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",currency:{name:"Fantom",symbol:"FTM",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Of},wrapped:{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",logo:zf},stables:{usd:["0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf","0x1B6382DBDEa11d97f24495C9A90b7c88469134a4"]},explorer:"https://ftmscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://ftmscan.com/tx/${t.id||t}`:e?`https://ftmscan.com/token/${e}`:n?`https://ftmscan.com/address/${n}`:void 0,endpoints:["https://rpc.ftm.tools","https://fantom.publicnode.com","https://rpc2.fantom.network"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"FTM",name:"Fantom",decimals:18,logo:Of,type:"NATIVE"},{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",symbol:"WFTM",name:"Wrapped Fantom",decimals:18,logo:zf,type:"20"},{address:"0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf",symbol:"lzUSDC",name:"LayerZero USDC",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"},{address:"0x1B6382DBDEa11d97f24495C9A90b7c88469134a4",symbol:"axlUSDC",name:"Axelar Wrapped USDC",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const _f="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/info/logo.png",Bf="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/assets/0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270/logo.png";var Rf={name:"polygon",id:"0x89",networkId:"137",namespace:"eip155",label:"Polygon (POS)",fullName:"Polygon (POS) Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMzEuNSA0NTkuM2MtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnYxOTQuNGMwIDE5LjIgOS42IDM2IDI0IDQzLjJsMTY1LjYgOTZjMTQuNCA5LjYgMzMuNiA5LjYgNDggMGwxNjUuNi05NmMxNC40LTkuNiAyNC0yNCAyNC00My4ydi02OS42bC03Ni44LTQzLjJ2NjQuOGMwIDE5LjItOS42IDM2LTI0IDQzLjJsLTg2LjQgNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtODYuNC01MC40Yy0xNC40LTkuNi0yNC0yNC0yNC00My4yVjU1MC41YzAtMTkuMiA5LjYtMzYgMjQtNDMuMmw4OC44LTUwLjRjMTQuNC05LjYgMzMuNi05LjYgNDggMGwxMTIuOCA2NC44IDc2LjggNDUuNiAxMTIuOCA2NC44YzE0LjQgOS42IDMzLjYgOS42IDQ4IDBsMTY4LTk2YzE0LjQtOS42IDI0LTI0IDI0LTQzLjJ2LTE5MmMwLTE0LjQtOS42LTMxLjItMjQtNDAuOGwtMTY4LTk2Yy0xNC40LTkuNi0zMy42LTkuNi00OCAwbC0xNjUuNiA5NmMtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnY2OS42bDc2LjggNDUuNnYtNjkuNmMwLTE5LjIgOS42LTM2IDI0LTQzLjJsODguOC01Mi44YzE0LjQtOS42IDMzLjYtOS42IDQ4IDBsODguOCA1MC40YzE0LjQgOS42IDI0IDI0IDI0IDQzLjJ2MTAwLjhjMCAxOS4yLTEyIDM2LTI0IDQzLjJsLTg4LjggNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtMTEyLjgtNjkuNi03OS4yLTQzLjItMTE3LjYtNjkuNmMtMTQuNC05LjYtMzMuNi05LjYtNDggMCAwIDIuNC0xNjAuOCA5OC40LTE2My4yIDk4LjR6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#824ee2",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMDkuNyA0NTljLTE2LjQgOS40LTI1LjggMjUuOC0yNS44IDQ2Ljl2MjA2LjNjMCAyMS4xIDkuNCAzNy41IDI1LjggNDYuOWwxNzUuOCAxMDMuMWMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBsMTc1LjgtMTAzLjFjMTYuNC05LjQgMjUuOC0yNS44IDI1LjgtNDYuOXYtNzIuN2wtODItNDYuOXY2OGMwIDIxLjEtOS40IDM3LjUtMjUuOCA0Ni45TDMzNyA3NjEuNGMtMTYuNCA5LjQtMzUuMiA5LjQtNTEuNiAwTDE5NCA3MDcuNWMtMTYuNC05LjQtMjUuOC0yNS44LTI1LjgtNDYuOVY1NTIuOGMwLTIxLjEgOS40LTM3LjUgMjUuOC00Ni45bDkzLjgtNTMuOWMxNC4xLTkuNCAzNS4yLTkuNCA1MS42IDBsMTE5LjUgNjggODIgNDkuMiAxMTkuNSA2OGMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBMODkwLjIgNTM0YzE2LjQtOS40IDI1LjgtMjUuOCAyNS44LTQ2LjlWMjgzLjJjMC0xNi40LTkuNC0zMi44LTI1LjgtNDIuMkw3MTIuMSAxMzcuOWMtMTYuNC05LjQtMzUuMi05LjQtNTEuNiAwTDQ4NC43IDI0MWMtMTYuNCA5LjQtMjUuOCAyNS44LTI1LjggNDYuOXY3NWw4MiA0OS4ydi03Mi43YzAtMjEuMSA5LjQtMzcuNSAyNS44LTQ2LjlsOTMuOC01Ni4zYzE2LjQtOS40IDM1LjItOS40IDUxLjYgMGw5My44IDUzLjljMTQuMSA5LjQgMjUuOCAyNS44IDI1LjggNDYuOXYxMDhjMCAyMS4xLTExLjcgMzcuNS0yNS44IDQ2LjlsLTkzLjggNTYuM2MtMTQuMSA5LjQtMzUuMiA5LjQtNTEuNiAwTDU0MSA0NzUuNGwtODItNDYuOS0xMjQuMi03Mi43Yy0xNC4xLTkuNC0zNS4yLTkuNC01MS42IDAtLjEuMS0xNzEuMiAxMDMuMi0xNzMuNSAxMDMuMnoiIGZpbGw9IiM4MjQ3ZTUiLz48L3N2Zz4=",currency:{name:"Polygon",symbol:"MATIC",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:_f},wrapped:{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",logo:Bf},stables:{usd:["0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359","0xc2132D05D31c914a87C6611C10748AEb04B58e8F"]},explorer:"https://polygonscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://polygonscan.com/tx/${t.id||t}`:e?`https://polygonscan.com/token/${e}`:n?`https://polygonscan.com/address/${n}`:void 0,endpoints:["https://polygon-rpc.com","https://polygon.meowrpc.com","https://polygon-bor.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"MATIC",name:"Polygon",decimals:18,logo:_f,type:"NATIVE"},{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",symbol:"WMATIC",name:"Wrapped Matic",decimals:18,logo:Bf,type:"20"},{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",type:"20"},{address:"0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xf6261529C6C2fBEB313aB25cDEcD243613b40EB5",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Uf="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDp1cmwoI1NWR0lEXzAwMDAwMDE5Njc2ODQzODE5NzI3MzAwODIwMDAwMDA1OTQ3NjMyODMzODYxMjM4OTE3Xyl9LnN0MntmaWxsOnVybCgjU1ZHSURfMDAwMDAwNjQzMjA1MjE4MTcxODM4NzM1NjAwMDAwMDMxNzkyNDIxNTkzMzkwODM5NjdfKX08L3N0eWxlPjxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfMV8iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iODE1Ljg1NiIgeTE9IjcwLjgyNCIgeDI9IjM4OC4zMzYiIHkyPSItNzQ4LjA1MiIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSA2NTcuOWM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDc5NS4xYy00LjkgNC45LTEyLjIgNy4zLTE3LjEgNy4zSDEyNS4zYy0xMi4yIDAtMTcuMS0xNC43LTkuOC0yNC41bDEyMi40LTEyMHoiIGZpbGw9InVybCgjU1ZHSURfMV8pIi8+PGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8wMDAwMDE1MDgxNTQ0MzI2NzI2OTc2MDQ0MDAwMDAxMzQ2MDgyNDM3MDQwMzE3MjU0M18iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iNjI4LjQ4MSIgeTE9IjE2NC4xMzQiIHgyPSIyMDAuOTYyIiB5Mj0iLTY1NC43NCIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSAyMDQuOGM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDM0MmMtNC45IDQuOS0xMi4yIDcuMy0xNy4xIDcuM0gxMjUuM2MtMTIuMiAwLTE3LjEtMTQuNy05LjgtMjJsMTIyLjQtMTIyLjV6IiBmaWxsPSJ1cmwoI1NWR0lEXzAwMDAwMTUwODE1NDQzMjY3MjY5NzYwNDQwMDAwMDEzNDYwODI0MzcwNDAzMTcyNTQzXykiLz48bGluZWFyR3JhZGllbnQgaWQ9IlNWR0lEXzAwMDAwMDA3NDA5ODc3MzYzMTA0OTgxNjMwMDAwMDE1MTMzNzA1NTcwNjgwMDk3NzA5XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI3MjAuOTIzIiB5MT0iMTE1Ljg3IiB4Mj0iMjkzLjQwNiIgeTI9Ii03MDMuMDAzIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMTkxLjQzNSkiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzAwZmZhMyIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2RjMWZmZiIvPjwvbGluZWFyR3JhZGllbnQ+PHBhdGggZD0iTTc2Mi4xIDQzMC4xYy00LjktNC45LTEyLjItNy4zLTE3LjEtNy4zSDEyNS4zYy0xMi4yIDAtMTcuMSAxNC43LTkuOCAyMkwyMzggNTY3LjNjNC45IDQuOSAxMi4yIDcuMyAxNy4xIDcuM2g2MTkuN2MxMi4yIDAgMTcuMS0xNC43IDkuOC0yMkw3NjIuMSA0MzAuMXoiIGZpbGw9InVybCgjU1ZHSURfMDAwMDAwMDc0MDk4NzczNjMxMDQ5ODE2MzAwMDAwMTUxMzM3MDU1NzA2ODAwOTc3MDlfKSIvPjwvc3ZnPgo=",Qf="https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png";var Yf={name:"solana",networkId:"solana",namespace:"solana",label:"Solana",fullName:"Solana Mainnet Beta",logo:Uf,logoBackgroundColor:"#000000",logoWhiteBackground:Uf,currency:{name:"Solana",symbol:"SOL",decimals:9,address:"11111111111111111111111111111111",logo:Qf},wrapped:{address:"So11111111111111111111111111111111111111112",logo:Qf},stables:{usd:["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"]},explorer:"https://solscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://solscan.io/tx/${t.id||t}`:e?`https://solscan.io/token/${e}`:n?`https://solscan.io/address/${n}`:void 0,endpoints:["https://solana.a.exodus.io","https://mainnet-beta.solflare.network","https://swr.xnftdata.com/rpc-proxy"],sockets:["wss://solana.drpc.org","wss://mainnet-beta.solflare.network","wss://solana.a.exodus.io"],tokens:[{address:"11111111111111111111111111111111",symbol:"SOL",name:"Solana",decimals:9,logo:Qf,type:"NATIVE"},{address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://img.raydium.io/icon/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v.png",type:"SPL"},{address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",symbol:"USDT",name:"USDT",decimals:6,logo:"https://img.raydium.io/icon/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB.png",type:"SPL"},{address:"7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj",symbol:"stSOL",name:"Lido Staked SOL",decimals:9,logo:"https://img.raydium.io/icon/7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj.png",type:"SPL"},{address:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",symbol:"BONK",name:"BONK",decimals:5,logo:"https://img.raydium.io/icon/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263.png",type:"SPL"},{address:"7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",symbol:"SAMO",name:"Samoyed Coin",decimals:9,logo:"https://img.raydium.io/icon/7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU.png",type:"SPL"},{address:"DePay1miDBPWXs6PVQrdC5Vch2jemgEPaiyXLNLLa2NF",symbol:"DEPAY",name:"DePay",decimals:9,logo:"https://depay.com/favicon.png",type:"SPL"}],zero:"0",maxInt:"340282366920938463463374607431768211455"};const Wf="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDojMjEzMTQ3fTwvc3R5bGU+PHBhdGggZD0iTTkyIDkyaDgxNnY4MTZIOTJWOTJ6IiBmaWxsPSJub25lIi8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTE2NS44IDM0MC4xVjY2MGMwIDIwLjYgMTAuOCAzOS4yIDI4LjcgNDkuNmwyNzcuMSAxNTkuOWMxNy42IDEwLjEgMzkuNSAxMC4xIDU3LjEgMGwyNzcuMS0xNTkuOWMxNy42LTEwLjEgMjguNy0yOSAyOC43LTQ5LjZWMzQwLjFjMC0yMC42LTEwLjgtMzkuMi0yOC43LTQ5LjZsLTI3Ny4xLTE2MGMtMTcuNi0xMC4xLTM5LjUtMTAuMS01Ny4xIDBsLTI3Ny4xIDE2MGMtMTcuNiAxMC4xLTI4LjQgMjktMjguNCA0OS42aC0uM3oiLz48cGF0aCBkPSJtNTYwLjQgNTYyLTM5LjUgMTA4LjRjLTEgMi45LTEgNi4yIDAgOS41bDY3LjkgMTg2LjQgNzguNi00NS40LTk0LjMtMjU4LjhjLTIuMy02LTEwLjQtNi0xMi43LS4xem03OS4zLTE4Mi4xYy0yLjMtNS45LTEwLjQtNS45LTEyLjcgMGwtMzkuNSAxMDguNGMtMSAyLjktMSA2LjIgMCA5LjVMNjk4LjggODAzbDc4LjYtNDUuNC0xMzcuNy0zNzcuNHYtLjN6IiBmaWxsPSIjMTJhYWZmIi8+PHBhdGggZD0iTTUwMCAxNDIuNmMyIDAgMy45LjYgNS41IDEuNmwyOTkuNiAxNzNjMy42IDIgNS41IDUuOSA1LjUgOS44djM0NmMwIDMuOS0yLjMgNy44LTUuNSA5LjhsLTI5OS42IDE3M2MtMS42IDEtMy42IDEuNi01LjUgMS42cy0zLjktLjYtNS41LTEuNmwtMjk5LjYtMTczYy0zLjYtMi01LjUtNS45LTUuNS05LjhWMzI2LjdjMC0zLjkgMi4zLTcuOCA1LjUtOS44bDI5OS42LTE3M2MxLjYtMSAzLjYtMS42IDUuNS0xLjZ2LjN6bTAtNTAuNmMtMTAuOCAwLTIxLjIgMi42LTMxIDguMmwtMjk5LjYgMTczYy0xOS4yIDExLjEtMzEgMzEuMy0zMSA1My41djM0NmMwIDIyLjIgMTEuOCA0Mi40IDMxIDUzLjVsMjk5LjYgMTczYzkuNSA1LjUgMjAuMiA4LjIgMzEgOC4yczIxLjItMi42IDMxLTguMmwyOTkuNi0xNzNjMTkuMi0xMS4xIDMxLTMxLjMgMzEtNTMuNXYtMzQ2YzAtMjIuMi0xMS44LTQyLjQtMzEtNTMuNWwtMjk5LjktMTczYy05LjUtNS41LTIwLjItOC4yLTMxLTguMmguM3oiIGZpbGw9IiM5ZGNjZWQiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJtMzAxLjUgODAzLjIgMjcuOC03NS43IDU1LjUgNDYtNTEuOSA0Ny43LTMxLjQtMTh6Ii8+PHBhdGggZD0iTTQ3NC41IDMwMi4yaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOEwyMjIuOSA3NTcuNWw3OC42IDQ1LjRMNDgxLjEgMzExYzEuNi00LjYtMS42LTkuMS02LjItOS4xbC0uNC4zem0xMzMuMiAwaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOGwtMTg2IDUwOS44IDc4LjYgNDUuNEw2MTMuOSAzMTFjMS42LTQuNi0xLjYtOS4xLTYuMi05LjF2LjN6IiBmaWxsPSIjZmZmIi8+PC9zdmc+Cg==";var Ff={name:"arbitrum",id:"0xa4b1",networkId:"42161",namespace:"eip155",platform:"evm",label:"Arbitrum",fullName:"Arbitrum One",logo:Wf,logoBackgroundColor:"#2b354d",logoWhiteBackground:Wf,currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Df.currency.logo},wrapped:{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",logo:Df.wrapped.logo},stables:{usd:["0xaf88d065e77c8cC2239327C5EDb3A432268e5831","0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"]},explorer:"https://arbiscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://arbiscan.io/tx/${t.id||t}`:e?`https://arbiscan.io/token/${e}`:n?`https://arbiscan.io/address/${n}`:void 0,endpoints:["https://arbitrum.blockpi.network/v1/rpc/public","https://arbitrum-one.publicnode.com","https://endpoints.omniatech.io/v1/arbitrum/one/public"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:Df.currency.logo,type:"NATIVE"},{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:Df.wrapped.logo,type:"20"},{address:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8/logo.png",type:"20"},{address:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1/logo.png",type:"20"},{address:"0x912CE59144191C1204E64559FE8253a0e49E6548",symbol:"ARB",name:"Arbitrum",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0x912CE59144191C1204E64559FE8253a0e49E6548/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Vf="https://traderjoexyz.com/static/media/avalanche.7c81486190237e87e238c029fd746008.svg",Hf="https://raw.githubusercontent.com/traderjoe-xyz/joe-tokenlists/main/logos/0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7/logo.png";var Gf={name:"avalanche",id:"0xa86a",networkId:"43114",namespace:"eip155",platform:"evm",label:"Avalanche",fullName:"Avalanche C-Chain",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0zNTkuMSA3NTEuMWgtOTUuM2MtMjAgMC0yOS45IDAtMzYtMy44LTYuNi00LjMtMTAuNC0xMS4zLTEwLjktMTguOS0uMy03LjEgNC42LTE1LjggMTQuNC0zM2wyMzUtNDE0LjNjMTAuMS0xNy42IDE1LjEtMjYuNCAyMS40LTI5LjYgNi45LTMuNSAxNS4xLTMuNSAyMS45IDAgNi40IDMuMyAxMS40IDEyIDIxLjQgMjkuNmw0OC40IDg0LjMuMi41YzEwLjggMTguOSAxNi4zIDI4LjUgMTguNiAzOC41IDIuNiAxMC45IDIuNiAyMi42IDAgMzMuNS0yLjQgMTAuMS03LjggMTkuOC0xOC44IDM4LjlMNDU2LjIgNjk0LjlsLS4zLjVjLTEwLjggMTktMTYuMyAyOC43LTI0LjEgMzYtOC4zIDgtMTguMyAxMy43LTI5LjMgMTYuOS05LjkgMi44LTIxLjEgMi44LTQzLjQgMi44em0yNDAuMyAwaDEzNi40YzIwLjIgMCAzMC4yIDAgMzYuMy00IDYuNi00LjMgMTAuNi0xMS4zIDEwLjktMTkuMS4zLTYuOS00LjUtMTUuMi0xMy45LTMxLjZsLTEtMS43TDY5OS44IDU3OGwtLjgtMS4yYy05LjYtMTYuMy0xNC40LTI0LjUtMjAuNy0yNy42LTYuOS0zLjYtMTUtMy42LTIxLjcgMC02LjIgMy4zLTExLjMgMTEuOC0yMS4zIDI5bC02OC4xIDExNi45LS4yLjNjLTEwLjEgMTcuMi0xNSAyNS44LTE0LjUgMzIuOC41IDcuNyA0LjUgMTQuOSAxMC45IDE5IDUuNyAzLjkgMTUuOCAzLjkgMzYgMy45eiIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#E84142",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yMzUuNiAyNTkuNWg1MjguOXY0ODFIMjM1LjZ2LTQ4MXoiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNOTI4IDUwMGMwIDIzNi40LTE5MS42IDQyOC00MjggNDI4UzcyIDczNi40IDcyIDUwMCAyNjMuNiA3MiA1MDAgNzJzNDI4IDE5MS42IDQyOCA0Mjh6TTM3OC43IDY3MC4zaC04My4xYy0xNy41IDAtMjYuMSAwLTMxLjMtMy40LTUuNy0zLjctOS4xLTkuOC05LjYtMTYuNS0uMy02LjIgNC0xMy44IDEyLjYtMjguOUw0NzIuNSAyNjBjOC43LTE1LjQgMTMuMS0yMyAxOC43LTI1LjkgNi0zIDEzLjEtMyAxOS4xIDAgNS42IDIuOCAxMCAxMC41IDE4LjcgMjUuOWw0Mi4yIDczLjYuMi40YzkuNCAxNi41IDE0LjIgMjQuOCAxNi4zIDMzLjYgMi4zIDkuNiAyLjMgMTkuNiAwIDI5LjItMi4xIDguOC02LjggMTcuMi0xNi40IDM0TDQ2My42IDYyMS4ybC0uMy41Yy05LjUgMTYuNi0xNC4zIDI1LTIxIDMxLjQtNy4zIDYuOS0xNiAxMi0yNS41IDE0LjgtOC43IDIuNC0xOC41IDIuNC0zOC4xIDIuNHptMjA5LjggMGgxMTljMTcuNiAwIDI2LjQgMCAzMS43LTMuNSA1LjctMy43IDkuMi05LjkgOS42LTE2LjYuMy02LTMuOS0xMy4zLTEyLjItMjcuNWwtLjktMS41LTU5LjYtMTAyLS43LTEuMWMtOC40LTE0LjItMTIuNi0yMS4zLTE4LTI0LjEtNi0zLTEzLjEtMy0xOSAwLTUuNSAyLjgtOS45IDEwLjMtMTguNiAyNS4zbC01OS40IDEwMi0uMi40Yy04LjcgMTUtMTMgMjIuNS0xMi43IDI4LjcuNCA2LjcgMy45IDEyLjkgOS42IDE2LjYgNSAzLjMgMTMuOCAzLjMgMzEuNCAzLjN6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2U4NDE0MiIvPjwvc3ZnPg==",currency:{name:"Avalanche",symbol:"AVAX",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Vf},wrapped:{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",logo:Hf},stables:{usd:["0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7","0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"]},explorer:"https://snowtrace.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://snowtrace.io/tx/${t.id||t}`:e?`https://snowtrace.io/token/${e}`:n?`https://snowtrace.io/address/${n}`:void 0,endpoints:["https://avalanche.public-rpc.com","https://avalanche.blockpi.network/v1/rpc/public","https://avax.meowrpc.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"AVAX",name:"Avalanche",decimals:18,logo:Vf,type:"NATIVE"},{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",symbol:"WAVAX",name:"Wrapped AVAX",decimals:18,logo:Hf,type:"20"},{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7/logo.png",type:"20"},{address:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E/logo.png",type:"20"},{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xd586E7F844cEa2F87f50152665BCbc2C279D8d70/logo.png",type:"20"},{address:"0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const qf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAMAAAAKTh9YAAAAYFBMVEVHcEz////////////////////////////////////j++ma6qVj5nsl5lAK4zpA6mXO79aD8Zyr87uCvq0J2TkItEkOhl4EeVsKzSwLrxMNtQpjsZG42dEeuxyF2oU6wzjPwJjeAAAACnRSTlMAEUB9r9j/YO+Kf6/iMwAABD1JREFUeAHU1EESQjEMAlBIAq33v7ArV7+OLss7AZOB4IDVI/kW0nQRf+Ca7QvNwg/s7VtpGJP8oPFNybdT4aidoPHEcYZn6ymnEEOjH8KPk0zeTI+DLacpfMhpxKTGnFtDB9o8/Jisw8uxh1/OtGIrYw9Ah9pEOVWhnaoxTvWCnErR2Z3rzX59JMYOAkEYXr1gRJfIzP1PalbOpZm2aEf+tcKnCCz7bS37si/7si/7si/7si/7srvRHAE5kJHdbV4wkn076Q9RMMLu04fYnceT/An9JnhMkr19Ezwvvvee73ieOL1dfdN15yQlwas2S7vbgTn4iLfaDO0emIPPeLtgZt+AOfhcQHJGdieYg88VLG9k98AUfG7gBRu7YAo+9wpeNLEnYAY+915wkIndQ4Xn9IajgoV9hwbP6b3iqGRhF5zH537VHi3swGl87tft3tB+Ap/7Z9lFhef0z3hndmjwnP4Z32qEAs/po4//Rwao8JzeC3hiMyeACs/ppnMCUlThOf3wxjurObAKz+kHNz5arT0CNHhO5zde7NZ8UYXn9N4K2Utnt8NzOsFL+Kuz2+EJneA5nduN8bmTWsXzKqNzuyX+FZ3rL43Sud0Un/txtV7KqNY+6Hq7Kb71Gxt0W7seX5od/Z6a+8BuGASCMMwraRK4103A9z9leq+Q3zCYC+h7oy7tbr6d4zGd2zme04Ed4AEd2AEe0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2Tl+B+jQzvH7j/ThnNub4Xd7Rud2gLc9pyM7wO9sz+nEDvA7e8G/0vX2IeTan/DXPdWL+cwD/hl/c3r2lT2u7XbWk31aYt9vesp9yD5Xn1ZPx7svtNtMYwfX9/hqjwAvuq8awIufZwzgxc+RZgAvfn43gBe/N5lxPLAD+sTs2HgnS53jnS51jHfC1CneKVOHeCdNneGdNnWEd+LUCd6pUwd4p04d4J06dYB3tekAL64nSAAvr+PgeGYHdI6ndkDneGoHdI4HdkAvxw/V7IsiegU8sIdSejk+VbIvyumveBY8twdQh51A8PL691x8PBf3HRD8oO33QPhR2mfD8EnZ3wTxXthXRvFe18+H8anbPsqkOVfnnJ6DF/RmPdE5vs69aQiYnoH3rXuzXukcP6jmE3C8734uxAgfgSvM4+D4RcV37SmgZ+BT6/kz0yd6KT5+kcex9bel+fDPupXP+MOs8byl6esGYfRxbDPnanG0OVf+8ODeH9Ks5f+mE50vJlp37d23EQQhFATRr6Yg/4RPuSe9o6tmIni7gN2222677bbbbrvttttuu5sw/7EP1j7kfhO6m5Wbak90Jw7d54NeGsV9jb0y1B+f+P5qpHB08XvD8M4zrq9N7pqje/L8jj/twXa8XOl4uSoe4/363RnvlyOo/LE1R8JnZfywrB7pGLY0Xa/gV5AhY9e5oJHCAAAAAElFTkSuQmCC",Zf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAYAAAA9kO9qAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0PSURBVHgB7d1LbFzVHcfx37l3/CDGxgkhxEnU2K1EgxoUN0kVUglhIhbdVAo7dpCiSl2BqbqphIRpuy5u95SwY1XSWlXVIhFXtGqjJsXQSJRCsXklaQiJ8zCxPTP3cv53cuOxZ8bjmbmP8z/n/5GMHcfjmPHXZ86ce++xQpJGxwdRwChCtQ9Q+nU4qt87CIVhCLGeEHP6v/NQag5h8DY8TKOEGcxMziMhCp2iwD0c1V/kE/QnUNxCJGdavxzHmRdfQYfajz2K3HsGKhyHBC7SN6dznUY5eEGP9nNoQ+uxS+Qib6GawL9++QJa1FrsB8fH9D/0sn5rGELka04PuMdwenJ6ozfwN/qB2D/+vP7ZOA4ZzYUZdIfqSQx9Fzj/979s5AbNR3aatvieHs3DoxDCSOqEnssfa7Zys37s0VKiOqmXhUYhhMlCvUwZhI+sF3zj2CV0wU2T4L2GN6Spi4QuOFG612jKXV/9J6j0ZFThRxCCnz2NnrTWTmMqy4snIQRnSk9n1ixL1k5jKuvoQvBGHdPzziqrY4/W0uWAkbDCMDw1Xv2OlWnM6PgwfDULIewxj3I4Eq/OrIzsvpqAEHYZrB7dq6cxD0MI2yg8E8/dK7HvH38SMlcXdqpcb4E49sqFF0LY6VbfqnKil7oCIewVPVH1omtGhbBbdG20hwBjEMJ2AcWuvH0QwnYK+zyE4TCEsF2oaGSXy+yEA3TntPQ4DCHsN+xBCEdI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwRgEWU30loK9c+cOCj3DB6v/dtqltS7ffDi/2wFZWffcpbv/IJXh7r8Hfe70SexWKPZjdhPKpzdGLzd/Y9dD9Uzh0BR69VIUeo/somO1D6c0tCN6y50I2hQPPhmCORqauxz9D4cjnLd2u9MY9KL6605noC9+/EN1PaweB9dB9Q/cR3VfcsY+9nW/gWsWpIRRf+hpspUa+RM/T/4OnX7eLol987n7WAwPb2Cnurqdn9cPxZSTBhm9mPfRo1/XUxx0NBtWWX9qN0tR2cMRyNYa+cT2/eDex0KPPqadCvfpzqjpzWK4Kj51D99MfJhY66X7qo+jRlCOWsdNI1clDciM2Be8/9AW6n/gEaaDg6UkuN+xip1Gl1SeirbAheH/0Krp/OIc09fz0v4k+YmSBVewUYBYPoZyD976xgMLjn0INpBui0scv6BGWE1ax06qLl1GAHIOn0D09qvt7biAL9Airdic/nUwLq9iznidyCj4KXb/438l2q/2uR9ObUiaNTex+g6N9aeMQfBx69PaORWTJPyKxJ45iz4vJwVeHrrYupz5XX4vm7mpkARywiT3v0EwMvjr0SH8RefBHeMzb2cTuGXCHmhR8Tej0Pj2y54HLk3g+I7sha7omBF8v9EhPgDxI7BbLM/iGoedpyQcHbGIPDDtBK4/gm4a+lM+3M7zK47IINrGbeDZilsFvZEQPr3UhD3ShBwd8Yp/dBBNlEfxGpy7huV7kIfjkDnDAJvbSqc0wVZrBtzJHD68X9Oie7ZSCHnHz+iFrFZ85+9kBoy+YTiP4dp6MBu/diSwV/3gvuGC1GlOaMvuOTTL4dlddyu/chTDDJ6rlv20BF8xiHzJuVWatJILvaHlRhx68M4AsFF/dxeoyRlaxhws+ln/9dZiuk+CTWEePRveU5+7xrgOcsDuoRHN3DndyO8EndsBIj+6l3w2lNp2h5050cTo3LI+g0sOnbcEnfWSUVmZKJ5IPPg6d4y4MPnYcngBDNMIT2vnLZHQKLO2+RTuQocFqUmqnANz0EX5wZ3QSnUrgvJnwcjcWJ/YYe8yjGbaxExuCT/1cl2VPx9kXxa46OCuy/O8BLP38Pr2mzuMAUj2sYyecg8/spC4dPB3SD/7T33L0wWe9KP15G5Z/sxuY7wZnVuz1SLoe/zS6INt08c5jqr+U29mL9G+rHYt6erMQnRZMf7799ekfDFzqRqBfwvf6EdzwUT6tf0Cv898D15rYCZvg9dy3+Id7jQ8oLCprQidWnc/OZpVmyzK6jp4H+s3dZMi20Il1F2+wCV6HbmrwNoZOrLxSSYJvn62hE2svy5PgW2dz6MTqa1Al+I2zPXRi/QXXEnxzLoROnNhdQIJvzJXQiTNbaUjwtVwKnTi1b4wEv8K10IlzmyRJ8G6GTpzcEczl4F0NnTi7/R234NWmzi/idjl04vRej6yCf/R9qJ4OfmnvTc/p0InzG5tyCR67+tB94FRbwUvoFbKLL3gF3/PAmy0Ffzv0mzx22k2TxH4Lh+DDzVug+pY2HLyEvprEXsX44H0fwcBdUL1fNg1eQq8lsa9BwZemtsNYd1QueG4WvIReS2KvI9rWzdRNVLtXLnpuFHxAu+pK6DUk9jpom73gbD9MFPau3sqiXvDhZzy2kM6axN4ABc9FTfBlBVFLYm9Abcvn1yw2VS7Xffft4PuuAr35/NY800nsddDejP7eazBSg9hJHLw/fBGilsReh8l7z6jFm+v/faGI3u+9Dm/7FxCrSexr0EZLhSOfw1Tqxo3mH6OD3/SD30vwa0jsVTjsKKYWmscefVzvsgS/hsR+C4vQr1xed85e8/ES/CoSO/jsEen9/wJaJcGvcD52LqGrS/p5xHJ7y6ESfIXTsXMJnSL3znX2dUrwDsfOKXT/ww+QBNeDdzJ2dqEvJ3c01+XgnYvd5dBjrgbvVOwS+goXg3cmdgm9lmvBOxG7hN6YS8FbH7uE3pwrwVsdu4S+cS4Eb23sEnrrbA/eytgl9PbZHLx1sUvonbM1eKtiZ/Mbrq8pY0OP2Ri8NbGzCf1iDxZ/sg9Lf3oAprMteCtiZxX6c/dHr5dPHsTSyQMwnU3Bs4+dY+gxCT5brGPnHHpMgs8O29htCD0mwWeDZew2hR7jFrwavA5u2MVeOHTZutBjvIKf0q87/6VmWeIX+1Mfw3TthB7jErynR/auw2fBCavYaacub5vZo0knoce4BN99+B1Wozuv2A2fviQReoxD8DSd4TS6s4nd23vN6FE9ydBjHILv+vZ74IJN7IVDV2CqNEKPmR48zd25rMywiV2NtP/bndOUZugx04P3R86BAz6xGziFySL0mMnBezKyJ8u0+XqWocdMDd7r57EiI7v4tiGP0GNcliVNxCZ2U34vaZ6hx0wLPrie333RCj6xX+xG3kwIPWZS8MH8ZnDAJvbg7ADyZFLoMVOCD84PggM2sZdO5Td6mBh6LO/gg/l+BBfuBgd8pjGzfbnM200OPZZn8OXZIXDB6Amqj9LUvcgSh9BjeQW/pP9dLlgtPZamhjIb3TmFHss6+OJb9yHU0xguWMVOo3vx1R1IG8fQYxT84m/HkDaaq3Ma1Qm7g0o0upfeuAdp4Rx6rDjzzdSDX5p6mNWoTlgeQS2+tBvB7CYkzYbQY2kGv/j6gyi9vxPc+NhxeALcFD2U/7oVatdNeLsWkQT64Vn62R4rQo8FF7YivNIPf+Q8VGHjvxm7kXCxR4/oD6F46lvgSOHAsyEYS2KngdLUdv1cYKcxpyQkjc5KvOPYFLzN7Z+dGJy/Gzdfe4TNmno97GMndPovRV84cqml25X1UVmKPO+js1mhq4q6x860FD09EV1+cz+K/9wD7qyIPUbR0+V7/qEr8Pdeh+orrfp7GrlpulLWR2PLb2y1diRvxh8+F4VPmx35Q6s3PApLXQg+H0B5Ti8EvDuiX6e/+pUVq2Kv5/ZFH3rZ0tW4m4l2COitbJ/NbYWlFdZ/9216wpkWeuKJRfvvJ7l4QzhDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyj2OQhhvzkPIeYhhO105zr28G0IYTsVfuRBYQZC2C7EjKdn7RK7sJ+HaQ+lKHaZtwu7lWhkn5mk0GV0Fzabps4r6+xh+AqEsNdx+k8l9gAnIFMZYaNQH0c682I0mFdip6lMGP4KQthGhdPxmyunCwSYhIzuwjZlvBC/uRK7jO7CNkqHPjM5F/9x9YlgNLqHcq6MsAB1fPrFiep3rY6dRncvPAYhuKvTsV/zQef+MYedDyr9GDAGITii6cvpyeO1727kwI9f048FRyEEK+EJnJl8rN7fNL54oxwco5NnIAQX1GsZDafhat0bj44PwlMn9UeNQgiTUehB+Mit01/qWv+yPLohfQKoExDCWHrq0iR0sv7IXu3g+ARC9TyEMEn0ZHT1EmPjD23FwfExBOplfathCJEnWken5cXTk9MbvUlrscdklBd5oWumPX2kv6QPgDaZtqzVXuxkdHwYvtLR42EZ6UXqOog81n7s1faPP6k/0xNyIEokigJX4Yx+/Up0GnqbkceSiT1GS5UFvUwZYEx/5n36ixzW/8SgjPyiqeicrHC+sgGAmtGRvx1dMtph4NW+AiZycfiu2QTRAAAAAElFTkSuQmCC";var Jf={name:"gnosis",id:"0x64",networkId:"100",namespace:"eip155",label:"Gnosis",fullName:"Gnosis Chain",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojZmZmfTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMzMS45IDU1Ni41YzIzLjUgMCA0Ni40LTcuOCA2NS0yMi4yTDI0OCAzODUuNGMtMzUuOSA0Ni40LTI3LjQgMTEyLjkgMTguOSAxNDguOCAxOC42IDE0IDQxLjUgMjEuOSA2NSAyMS45di40em00NDIuMy0xMDYuMWMwLTIzLjUtNy44LTQ2LjQtMjIuMi02NUw2MDMuMiA1MzQuMmM0Ni40IDM1LjkgMTEyLjkgMjcuNCAxNDguOC0xOC45IDE0LjMtMTguNiAyMi4yLTQxLjQgMjIuMi02NC45eiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im04NDkuMiAyODguNS02NS45IDY1LjljNTIuOSA2My42IDQ0LjcgMTU4LTE4LjkgMjExLjItNTUuNiA0Ni43LTEzNi42IDQ2LjctMTkyLjIgMEw1MDAgNjM3LjdsLTcyLjEtNzIuMWMtNjMuNiA1Mi45LTE1OCA0NC43LTIxMS4yLTE4LjktNDYuNy01NS42LTQ2LjctMTM2LjYgMC0xOTIuMmwtMzMuNi0zMy42LTMyLTMyLjNDMTEyLjMgMzUyLjIgOTIgNDI1LjMgOTIgNTAwYzAgMjI1LjIgMTgyLjggNDA4IDQwOCA0MDhzNDA4LTE4Mi44IDQwOC00MDhjLjMtNzQuNC0yMC42LTE0Ny44LTU4LjgtMjExLjV6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTc5NS4xIDIxOC4zYy0xNTUuNC0xNjIuOC00MTMuNi0xNjktNTc2LjQtMTMuNy00LjkgNC42LTkuNSA5LjEtMTMuNyAxMy43LTEwLjEgMTAuOC0xOS42IDIxLjktMjguNyAzMy4zTDUwMCA1NzUuNGwzMjMuOC0zMjMuOGMtOC44LTExLjctMTguNi0yMi44LTI4LjctMzMuM3pNNTAwIDE0NS4yYzk1LjMgMCAxODQuMSAzNi45IDI1MSAxMDMuOEw1MDAgNTAwIDI0OSAyNDljNjYuNi02Ny4yIDE1NS43LTEwMy44IDI1MS0xMDMuOHoiLz48L3N2Zz4K",logoBackgroundColor:"#406958",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojM2U2OTU3fTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMyNC4yIDU1OS4xYzI0LjYgMCA0OC41LTguMiA2Ny45LTIzLjJMMjM2LjUgMzgwLjJjLTM3LjUgNDguNS0yOC43IDExOC4xIDE5LjggMTU1LjYgMTkuNSAxNC43IDQzLjMgMjIuOSA2Ny45IDIyLjl2LjR6TTc4Ni43IDQ0OC4xYzAtMjQuNi04LjItNDguNS0yMy4yLTY3LjlMNjA3LjkgNTM1LjhjNDguNSAzNy41IDExOC4xIDI4LjcgMTU1LjYtMTkuOCAxNS0xOS40IDIzLjItNDMuMyAyMy4yLTY3Ljl6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0ibTg2NS4yIDI3OC44LTY4LjkgNjguOWM1NS4zIDY2LjYgNDYuOCAxNjUuMi0xOS44IDIyMC44LTU4LjQgNDguOC0xNDIuNyA0OC44LTIwMSAwTDUwMCA2NDRsLTc1LjQtNzUuNGMtNjYuNiA1NS4zLTE2NS4yIDQ2LjgtMjIwLjgtMTkuOC00OC44LTU4LjQtNDguOC0xNDIuNyAwLTIwMWwtMzUuMi0zNS4yLTMzLjQtMzMuOGMtNDAuNiA2Ni42LTYxLjggMTQzLTYxLjggMjIxLjIgMCAyMzUuNSAxOTEuMSA0MjYuNiA0MjYuNiA0MjYuNlM5MjYuNiA3MzUuNSA5MjYuNiA1MDBjLjQtNzcuOC0yMS41LTE1NC42LTYxLjQtMjIxLjJ6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTgwOC42IDIwNS41QzY0Ni4xIDM1LjEgMzc2LjEgMjguNyAyMDUuOCAxOTEuMWMtNS4xIDQuOC05LjkgOS42LTE0LjMgMTQuMy0xMC42IDExLjMtMjAuNSAyMi45LTMwIDM0LjhMNTAwIDU3OC44bDMzOC42LTMzOC42Yy05LjItMTIuMi0xOS41LTIzLjgtMzAtMzQuN3pNNTAwIDEyOWM5OS43IDAgMTkyLjUgMzguNiAyNjIuNSAxMDguNUw1MDAgNTAwIDIzNy41IDIzNy41QzMwNy4yIDE2Ny4yIDQwMC4zIDEyOSA1MDAgMTI5eiIvPjwvc3ZnPgo=",currency:{name:"xDAI",symbol:"xDAI",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:qf},wrapped:{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",logo:Zf},stables:{usd:["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"]},explorer:"https://gnosisscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://gnosisscan.io/tx/${t.id||t}`:e?`https://gnosisscan.io/token/${e}`:n?`https://gnosisscan.io/address/${n}`:void 0,endpoints:["https://rpc.gnosis.gateway.fm","https://rpc.gnosischain.com","https://gnosis.blockpi.network/v1/rpc/public"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"xDAI",name:"xDAI",decimals:18,logo:qf,type:"NATIVE"},{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",symbol:"WXDAI",name:"Wrapped XDAI",decimals:18,logo:Zf,type:"20"},{address:"0x4ECaBa5870353805a9F068101A40E0f32ed605C6",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb",symbol:"GNO",name:"Gnosis",decimals:18,logo:"https://cdn.sushi.com/image/upload/f_auto,c_limit,w_16,q_auto/tokens/100/0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb.jpg",type:"20"},{address:"0xD057604A14982FE8D88c5fC25Aac3267eA142a08",symbol:"HOPR",name:"HOPR",decimals:18,logo:"https://hoprnet.org/assets/icons/hopr_icon.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};var Xf={name:"optimism",id:"0xa",networkId:"10",namespace:"eip155",label:"Optimism",fullName:"Optimism",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00ODcuMSAzOTUuN2MtNS4yLTE1LjgtMTMuMi0zMS43LTI2LjQtNDIuMi0xMy4yLTEwLjUtMjYuNC0yMS4yLTQ0LjktMjYuNC0xOC41LTUuMi0zNy04LTU4LjEtOC00Ny41IDAtODcuMSAxMC41LTExNi4xIDM0LjQtMjkgMjMuOC00Ny41IDU4LjEtNjAuNyAxMDIuOS0yLjYgMTUuOC04IDI5LTEwLjUgNDQuOS0yLjYgMTMuMi01LjIgMjktOCA0Mi4yLTIuNiAyMy44LTIuNiA0Mi4yIDIuNiA2MC43IDUuMiAxNS44IDEzLjIgMzEuNyAyNi40IDQyLjIgMTMuMiAxMC41IDI2LjQgMjEuMiA0NC45IDI2LjQgMTguNCA1LjIgMzcgOCA1OC4xIDggNDcuNSAwIDg3LjEtMTAuNSAxMTYuMS0zNC40czQ3LjUtNTguMSA2MC43LTEwMi45YzIuNi0xMy4yIDUuMi0yOSAxMC41LTQyLjIgMi42LTEzLjIgNS4yLTI5IDgtNDQuOSAyLjgtMjMuOCAyLjgtNDQuOC0yLjYtNjAuN3ptLTkyLjQgNjAuOGMtMi42IDEzLjItNS4yIDI2LjQtOCAzOS41LTIuNiAxMy4yLTUuMiAyNi40LTEwLjUgNDIuMi01LjIgMjMuOC0xNS44IDM5LjUtMjkgNTAuMi0xMy4yIDEwLjUtMjkgMTUuOC00Ny41IDE1LjgtMTguNCAwLTMxLjctNS4yLTM5LjUtMTUuOC04LTEwLjUtMTAuNS0yOS01LjItNTAuMiAyLjYtMTUuOCA1LjItMjkgOC00Mi4yIDIuNi0xMy4yIDUuMi0yNi40IDEwLjUtMzkuNSA1LjItMjMuOCAxNS44LTM5LjUgMjktNTAuMiAxMy4yLTEwLjUgMjktMTUuOCA0Ny41LTE1LjggMTguNCAwIDMxLjcgNS4yIDM5LjUgMTUuOCA3LjkgMTAuNiAxMC41IDI2LjMgNS4yIDUwLjJ6bTQ0MC45LTY4LjZjLTUuMi0xNS44LTEzLjItMjYuNC0yMy44LTM3cy0yMy44LTE1LjgtNDIuMi0yMS4yYy0xNS44LTUuMi0zNC40LTgtNTUuNC04SDU3OS43Yy0yLjYgMC01LjIgMC0xMC41IDIuNi0yLjYgMi42LTUuMiA1LjItNS4yIDhsLTY4LjYgMzI3LjRjMCAyLjYgMCA4IDIuNiA4IDIuNiAyLjYgNS4yIDIuNiA4IDIuNmg2OC42YzIuNiAwIDggMCAxMC41LTIuNnM1LjItNS4yIDUuMi04bDIzLjgtMTEwLjloNjguNmM0Mi4yIDAgNzYuNi04IDEwMi45LTI2LjQgMjYuNC0xOC40IDQyLjItNDcuNSA1MC4yLTg0LjYgNS4xLTE4LjQgNS4xLTM2LjctLjItNDkuOXpNNzQzLjEgNDM4Yy0yLjYgMTUuOC0xMC41IDI2LjQtMjEuMiAzNC40cy0yMy44IDEwLjUtMzcgMTAuNWgtNTguMWwxOC40LTg5LjdoNjAuN2MxMy4yIDAgMjEuMiAyLjYgMjYuNCA1LjIgNS4yIDUuMiAxMC41IDEwLjUgMTAuNSAxNS44IDMgNS4yIDMgMTMuMi4zIDIzLjh6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",logoBackgroundColor:"#FF0420",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iMzk2LjYiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNNTAwIDg5Ni42YzIxOS4xIDAgMzk2LjYtMTc3LjYgMzk2LjYtMzk2LjZTNzE5LjEgMTAzLjQgNTAwIDEwMy40IDEwMy40IDI4MC45IDEwMy40IDUwMCAyODAuOSA4OTYuNiA1MDAgODk2LjZ6TTM1MC43IDYwOWMxMC45IDMuNCAyMi42IDUuMSAzNS4zIDUuMSAyOS4xIDAgNTIuNC02LjcgNjkuNi0yMC4yIDE3LjMtMTMuNyAyOS4zLTM0LjMgMzYuMi02MS44IDItOC42IDMuOS0xNy4zIDUuNy0yNS45IDItOC42IDMuNy0xNy40IDUuMS0yNi4yIDIuNC0xMy43IDItMjUuNi0xLjItMzUuOS0zLTEwLjItOC4zLTE4LjktMTYtMjUuOS03LjQtNy0xNi42LTEyLjMtMjcuNC0xNS43LTEwLjctMy42LTIyLjMtNS40LTM1LTUuNC0yOS4zIDAtNTIuNyA3LTY5LjkgMjEuMXMtMjkuMiAzNC43LTM1LjkgNjEuOGMtMiA4LjgtNCAxNy42LTYgMjYuMi0xLjggOC42LTMuNSAxNy4zLTUuMSAyNS45LTIuMiAxMy43LTEuOCAyNS42IDEuMiAzNS45IDMuMiAxMC4yIDguNSAxOC44IDE2IDI1LjYgNy40IDYuOCAxNi42IDExLjkgMjcuNCAxNS40em02Ny44LTQ4Yy04LjIgNi40LTE3LjggOS42LTI4LjYgOS42LTExLjEgMC0xOS0zLjItMjMuOC05LjYtNC44LTYuNC02LTE2LjctMy42LTMwLjcgMS42LTguOCAzLjItMTcuMiA0LjgtMjUgMS44LTcuOCAzLjgtMTYgNi0yNC40IDMuNC0xNC4xIDkuMS0yNC4zIDE3LjItMzAuNyA4LjItNi40IDE3LjgtOS42IDI4LjYtOS42czE4LjggMy4yIDIzLjggOS42IDYuMiAxNi43IDMuNiAzMC43Yy0xLjQgOC40LTMgMTYuNi00LjggMjQuNC0xLjYgNy44LTMuNSAxNi4yLTUuNyAyNS0zLjQgMTQtOS4yIDI0LjMtMTcuNSAzMC43em05MS43IDQ4YzEuMiAxLjQgMi44IDIuMSA0LjggMi4xaDQxYzIuMiAwIDQuMS0uNyA1LjctMi4xIDEuOC0xLjQgMi45LTMuMiAzLjMtNS40bDEzLjktNjZoNDAuN2MyNS45IDAgNDYuNS01LjUgNjEuOC0xNi42IDE1LjUtMTEuMSAyNS43LTI4LjEgMzAuNy01MS4yIDIuNC0xMS43IDIuMy0yMS44LS4zLTMwLjQtMi42LTguOC03LjItMTYuMi0xMy45LTIyLTYuNi01LjgtMTUtMTAuMS0yNS0xMy05LjgtMi44LTIwLjktNC4yLTMzLjItNC4yaC04MC4yYy0yIDAtMy45LjctNS43IDIuMS0xLjggMS40LTIuOSAzLjItMy4zIDUuNEw1MDkgNjAzLjVjLS40IDIuMiAwIDQgMS4yIDUuNXptMTExLjItMTEzLjFoLTM0LjdsMTEuOC01NGgzNi4yYzcuMiAwIDEyLjYgMS4yIDE2IDMuNiAzLjYgMi40IDUuNyA1LjYgNi4zIDkuNi42IDQgLjQgOC42LS42IDEzLjktMiA5LTYuMyAxNS44LTEzIDIwLjItNi40IDQuNS0xMy44IDYuNy0yMiA2Ljd6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmMDQyMCIvPjwvc3ZnPg==",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Df.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:Df.wrapped.logo},stables:{usd:["0x94b008aA00579c1307B0EF2c499aD98a8ce58e58","0x7F5c764cBc14f9669B88837ca1490cCa17c31607"]},explorer:"https://optimistic.etherscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://optimistic.etherscan.io/tx/${t.id||t}`:e?`https://optimistic.etherscan.io/token/${e}`:n?`https://optimistic.etherscan.io/address/${n}`:void 0,endpoints:["https://optimism.blockpi.network/v1/rpc/public","https://optimism.meowrpc.com","https://optimism.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:Df.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:Df.wrapped.logo,type:"20"},{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x94b008aA00579c1307B0EF2c499aD98a8ce58e58/logo.png",type:"20"},{address:"0x7F5c764cBc14f9669B88837ca1490cCa17c31607",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x7F5c764cBc14f9669B88837ca1490cCa17c31607/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x4200000000000000000000000000000000000042",symbol:"OP",name:"Optimism",decimals:18,logo:"https://user-images.githubusercontent.com/1300064/219575413-d7990d69-1d21-44ef-a2b1-e9c682c79802.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};var Kf={name:"base",id:"0x2105",networkId:"8453",namespace:"eip155",label:"Base",fullName:"Base",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguNiA4NDJDNjg4IDg0MiA4NDIgNjg4LjkgODQyIDQ5OS41UzY4OCAxNTcgNDk4LjYgMTU3QzMxOSAxNTcgMTcxLjIgMjk1LjEgMTU3IDQ3MC4zaDQ1My4xdjU3LjVIMTU3QzE3MiA3MDMuOSAzMTkgODQyIDQ5OC42IDg0MnoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#0052FF",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguOSA4NDVDNjkwLjEgODQ1IDg0NSA2OTAuMyA4NDUgNDk5LjVTNjkwLjEgMTU0IDQ5OC45IDE1NEMzMTcuNiAxNTQgMTY4LjggMjkzLjMgMTU0IDQ3MC41aDQ1Ny40djU4LjFIMTU0QzE2OC44IDcwNS44IDMxNy42IDg0NSA0OTguOSA4NDV6IiBmaWxsPSIjMDA1MmZmIi8+PC9zdmc+",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Df.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:Df.wrapped.logo},stables:{usd:["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA"]},explorer:"https://basescan.org",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://basescan.org/tx/${t.id||t}`:e?`https://basescan.org/token/${e}`:n?`https://basescan.org/address/${n}`:void 0,endpoints:["https://base.blockpi.network/v1/rpc/public","https://base.meowrpc.com","https://mainnet.base.org"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:Df.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:Df.wrapped.logo,type:"20"},{address:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA",symbol:"USDbC",name:"USD Base Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const $f=[Df,Sf,Rf,Yf,Pf,Ff,Gf,Jf,Xf,Kf];var tp={ethereum:Df,bsc:Sf,polygon:Rf,solana:Yf,fantom:Pf,arbitrum:Ff,avalanche:Gf,gnosis:Jf,optimism:Xf,base:Kf,all:$f,findById:function(t){let e=t;return e.match("0x0")&&(e=e.replace(/0x0+/,"0x")),$f.find((t=>t.id&&t.id.toLowerCase()==e.toLowerCase()))},findByNetworkId:function(t){return t=t.toString(),$f.find((e=>e.networkId==t))},findByName:function(t){return $f.find((e=>e.name==t))}},ep="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function np(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function rp(t){var e={exports:{}};return t(e,e.exports),e.exports}for(var ip=function(t){var e=fp(t),n=e[0],r=e[1];return 3*(n+r)/4-r},op=function(t){var e,n,r=fp(t),i=r[0],o=r[1],a=new cp(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),s=0,u=o>0?i-4:i;for(n=0;n>16&255,a[s++]=e>>8&255,a[s++]=255&e;2===o&&(e=up[t.charCodeAt(n)]<<2|up[t.charCodeAt(n+1)]>>4,a[s++]=255&e);1===o&&(e=up[t.charCodeAt(n)]<<10|up[t.charCodeAt(n+1)]<<4|up[t.charCodeAt(n+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e);return a},ap=function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,a=0,s=n-r;as?s:a+o));1===r?(e=t[n-1],i.push(sp[e>>2]+sp[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(sp[e>>10]+sp[e>>4&63]+sp[e<<2&63]+"="));return i.join("")},sp=[],up=[],cp="undefined"!=typeof Uint8Array?Uint8Array:Array,lp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hp=0,dp=lp.length;hp0)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 pp(t,e,n){for(var r,i,o=[],a=e;a>18&63]+sp[i>>12&63]+sp[i>>6&63]+sp[63&i]);return o.join("")}up["-".charCodeAt(0)]=62,up["_".charCodeAt(0)]=63;var yp={byteLength:ip,toByteArray:op,fromByteArray:ap},mp=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},gp=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;t[n+f]=255&a,f+=p,a/=256,c-=8);t[n+f-p]|=128*y},vp=rp((function(t,e){const n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){+t!=t&&(t=0);return o.alloc(+t)},e.INSPECT_MAX_BYTES=50;const r=2147483647;function i(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|d(t,e);let r=i(n);const a=r.write(t,e);a!==n&&(r=r.slice(0,a));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(H(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(H(t,ArrayBuffer)||t&&H(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(H(t,SharedArrayBuffer)||t&&H(t.buffer,SharedArrayBuffer)))return l(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return o.from(r,e,n);const a=function(t){if(o.isBuffer(t)){const e=0|h(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||G(t.length)?i(0):c(t);if("Buffer"===t.type&&Array.isArray(t.data))return c(t.data)}(t);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return s(t),i(t<0?0:0|h(t))}function c(t){const e=t.length<0?0:0|h(t.length),n=i(e);for(let r=0;r=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function d(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||H(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(t).length;default:if(i)return r?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function f(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,n);case"utf8":case"utf-8":return N(this,e,n);case"ascii":return E(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function p(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:m(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):m(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,n,r,i){let o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){let r=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let a;for(r>o/2&&(r=o/2),a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?yp.fromByteArray(t):yp.fromByteArray(t.slice(e,n))}function N(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+a<=n){let n,r,s,u;switch(a){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],s=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(t){const e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(o.isBuffer(e)||(e=o.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!o.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},o.byteLength=d,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(t+=" ... "),""},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(t,e,n,r,i){if(H(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const u=Math.min(a,s),c=this.slice(r,i),l=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return g(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return w(this,t,e,n);case"base64":return b(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function E(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function S(t,e,n,r,i,a){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function j(t,e,n,r,i){R(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,n}function C(t,e,n,r,i){R(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=a,a>>=8,t[n+2]=a,a>>=8,t[n+1]=a,a>>=8,t[n]=a,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,4),gp(t,e,n,r,23,4),n+4}function z(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,8),gp(t,e,n,r,52,8),n+8}o.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readBigUInt64LE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readBigInt64LE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||L(t,4,this.length),mp(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),mp(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),mp(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),mp(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){S(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,!r){S(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigUInt64LE=Z((function(t,e=0){return j(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Z((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,t,e,n,r-1,-r)}let i=0,o=1,a=0;for(this[e]=255&t;++i>0)-a&255;return e+n},o.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,t,e,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/o>>0)-a&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigInt64LE=Z((function(t,e=0){return j(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Z((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(t,e,n){return O(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return O(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return z(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return z(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function R(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new P.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){U(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||Q(e,t.length-(n+1))}(r,i,o)}function U(t,e){if("number"!=typeof t)throw new P.ERR_INVALID_ARG_TYPE(e,"number",t)}function Q(t,e,n){if(Math.floor(t)!==t)throw U(t,n),new P.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new P.ERR_BUFFER_OUT_OF_BOUNDS;throw new P.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}_("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),_("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),_("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=B(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=B(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const Y=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let a=0;a55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.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;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(t){return yp.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(Y,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function H(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function G(t){return t!=t}const q=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}})),wp=rp((function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:vp.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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];i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.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;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 I(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){I.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return v[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,I),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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,ep)})); -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */let bp=!1,Mp=!1;const Ap={debug:1,default:2,info:2,warning:3,error:4,off:5};let Np=Ap.default,Ip=null;const Ep=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(n){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var xp,kp;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(xp||(xp={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(kp||(kp={}));const Tp="0123456789abcdef";class Lp{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();null==Ap[n]&&this.throwArgumentError("invalid log level name","logLevel",t),Np>Ap[n]||console.log.apply(console,e)}debug(...t){this._log(Lp.levels.DEBUG,t)}info(...t){this._log(Lp.levels.INFO,t)}warn(...t){this._log(Lp.levels.WARNING,t)}makeError(t,e,n){if(Mp)return this.makeError("censored error",e,{});e||(e=Lp.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((t=>{const e=n[t];try{if(e instanceof Uint8Array){let n="";for(let t=0;t>4],n+=Tp[15&e[t]];r.push(t+"=Uint8Array(0x"+n+")")}else r.push(t+"="+JSON.stringify(e))}catch(e){r.push(t+"="+JSON.stringify(n[t].toString()))}})),r.push(`code=${e}`),r.push(`version=${this.version}`);const i=t;let o="";switch(e){case kp.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case kp.CALL_EXCEPTION:case kp.INSUFFICIENT_FUNDS:case kp.MISSING_NEW:case kp.NONCE_EXPIRED:case kp.REPLACEMENT_UNDERPRICED:case kp.TRANSACTION_REPLACED:case kp.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(t+=" ("+r.join(", ")+")");const a=new Error(t);return a.reason=i,a.code=e,Object.keys(n).forEach((function(t){a[t]=n[t]})),a}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,Lp.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,r){t||this.throwError(e,n,r)}assertArgument(t,e,n,r){t||this.throwArgumentError(e,n,r)}checkNormalize(t){Ep&&this.throwError("platform missing String.prototype.normalize",Lp.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Ep})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Lp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Lp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",te&&this.throwError("too many arguments"+n,Lp.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Lp.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Lp.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Lp.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Ip||(Ip=new Lp("logger/5.7.0")),Ip}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Lp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),bp){if(!t)return;this.globalLogger().throwError("error censorship permanent",Lp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Mp=!!t,bp=!!e}static setLogLevel(t){const e=Ap[t.toLowerCase()];null!=e?Np=e:Lp.globalLogger().warn("invalid log level - "+t)}static from(t){return new Lp(t)}}Lp.errors=kp,Lp.levels=xp;const Sp=new Lp("bytes/5.7.0");function jp(t){return!!t.toHexString}function Cp(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Cp(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Dp(t){return Up(t)&&!(t.length%2)||zp(t)}function Op(t){return"number"==typeof t&&t==t&&t%1==0}function zp(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Op(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Pp(t,e){if(e||(e={}),"number"==typeof t){Sp.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Cp(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),jp(t)&&(t=t.toHexString()),Up(t)){let n=t.substring(2);n.length%2&&("left"===e.hexPad?n="0"+n:"right"===e.hexPad?n+="0":Sp.throwArgumentError("hex data is odd-length","value",t));const r=[];for(let t=0;tPp(t))),n=e.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(n);return e.reduce(((t,e)=>(r.set(e,t),t+e.length)),0),Cp(r)}function Bp(t){let e=Pp(t);if(0===e.length)return e;let n=0;for(;ne&&Sp.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(e);return n.set(t,e-t.length),Cp(n)}function Up(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const Qp="0123456789abcdef";function Yp(t,e){if(e||(e={}),"number"==typeof t){Sp.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Qp[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),jp(t))return t.toHexString();if(Up(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Sp.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(zp(t)){let e="0x";for(let n=0;n>4]+Qp[15&r]}return e}return Sp.throwArgumentError("invalid hexlify value","value",t)}function Wp(t){if("string"!=typeof t)t=Yp(t);else if(!Up(t)||t.length%2)return null;return(t.length-2)/2}function Fp(t,e,n){return"string"!=typeof t?t=Yp(t):(!Up(t)||t.length%2)&&Sp.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=n?"0x"+t.substring(e,2+2*n):"0x"+t.substring(e)}function Vp(t){let e="0x";return t.forEach((t=>{e+=Yp(t).substring(2)})),e}function Hp(t){const e=function(t){"string"!=typeof t&&(t=Yp(t));Up(t)||Sp.throwArgumentError("invalid hex string","value",t);t=t.substring(2);let e=0;for(;e2*e+2&&Sp.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function qp(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Dp(t)){let n=Pp(t);64===n.length?(e.v=27+(n[32]>>7),n[32]&=127,e.r=Yp(n.slice(0,32)),e.s=Yp(n.slice(32,64))):65===n.length?(e.r=Yp(n.slice(0,32)),e.s=Yp(n.slice(32,64)),e.v=n[64]):Sp.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:Sp.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(n[32]|=128),e._vs=Yp(n.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const n=Rp(Pp(e._vs),32);e._vs=Yp(n);const r=n[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=r:e.recoveryParam!==r&&Sp.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;const i=Yp(n);null==e.s?e.s=i:e.s!==i&&Sp.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?Sp.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const n=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==n&&Sp.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&Up(e.r)?e.r=Gp(e.r,32):Sp.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&Up(e.s)?e.s=Gp(e.s,32):Sp.throwArgumentError("signature missing or invalid s","signature",t);const n=Pp(e.s);n[0]>=128&&Sp.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(n[0]|=128);const r=Yp(n);e._vs&&(Up(e._vs)||Sp.throwArgumentError("signature invalid _vs","signature",t),e._vs=Gp(e._vs,32)),null==e._vs?e._vs=r:e._vs!==r&&Sp.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const Zp="bignumber/5.7.0";var Jp=wp.BN;const Xp=new Lp(Zp),Kp={},$p=9007199254740991;let ty=!1;class ey{constructor(t,e){t!==Kp&&Xp.throwError("cannot call constructor directly; use BigNumber.from",Lp.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return ry(iy(this).fromTwos(t))}toTwos(t){return ry(iy(this).toTwos(t))}abs(){return"-"===this._hex[0]?ey.from(this._hex.substring(1)):this}add(t){return ry(iy(this).add(iy(t)))}sub(t){return ry(iy(this).sub(iy(t)))}div(t){return ey.from(t).isZero()&&oy("division-by-zero","div"),ry(iy(this).div(iy(t)))}mul(t){return ry(iy(this).mul(iy(t)))}mod(t){const e=iy(t);return e.isNeg()&&oy("division-by-zero","mod"),ry(iy(this).umod(e))}pow(t){const e=iy(t);return e.isNeg()&&oy("negative-power","pow"),ry(iy(this).pow(e))}and(t){const e=iy(t);return(this.isNegative()||e.isNeg())&&oy("unbound-bitwise-result","and"),ry(iy(this).and(e))}or(t){const e=iy(t);return(this.isNegative()||e.isNeg())&&oy("unbound-bitwise-result","or"),ry(iy(this).or(e))}xor(t){const e=iy(t);return(this.isNegative()||e.isNeg())&&oy("unbound-bitwise-result","xor"),ry(iy(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&oy("negative-width","mask"),ry(iy(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&oy("negative-width","shl"),ry(iy(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&oy("negative-width","shr"),ry(iy(this).shrn(t))}eq(t){return iy(this).eq(iy(t))}lt(t){return iy(this).lt(iy(t))}lte(t){return iy(this).lte(iy(t))}gt(t){return iy(this).gt(iy(t))}gte(t){return iy(this).gte(iy(t))}isNegative(){return"-"===this._hex[0]}isZero(){return iy(this).isZero()}toNumber(){try{return iy(this).toNumber()}catch(t){oy("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Xp.throwError("this platform does not support BigInt",Lp.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?ty||(ty=!0,Xp.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Xp.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Lp.errors.UNEXPECTED_ARGUMENT,{}):Xp.throwError("BigNumber.toString does not accept parameters",Lp.errors.UNEXPECTED_ARGUMENT,{})),iy(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof ey)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new ey(Kp,ny(t)):t.match(/^-?[0-9]+$/)?new ey(Kp,ny(new Jp(t))):Xp.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&oy("underflow","BigNumber.from",t),(t>=$p||t<=-$p)&&oy("overflow","BigNumber.from",t),ey.from(String(t));const e=t;if("bigint"==typeof e)return ey.from(e.toString());if(zp(e))return ey.from(Yp(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return ey.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Up(t)||"-"===t[0]&&Up(t.substring(1))))return ey.from(t)}return Xp.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function ny(t){if("string"!=typeof t)return ny(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Xp.throwArgumentError("invalid hex","value",t),"0x00"===(t=ny(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function ry(t){return ey.from(ny(t))}function iy(t){const e=ey.from(t).toHexString();return"-"===e[0]?new Jp("-"+e.substring(3),16):new Jp(e.substring(2),16)}function oy(t,e,n){const r={fault:t,operation:e};return null!=n&&(r.value=n),Xp.throwError(t,Lp.errors.NUMERIC_FAULT,r)}const ay=new Lp(Zp),sy={},uy=ey.from(0),cy=ey.from(-1);function ly(t,e,n,r){const i={fault:e,operation:n};return void 0!==r&&(i.value=r),ay.throwError(t,Lp.errors.NUMERIC_FAULT,i)}let hy="0";for(;hy.length<256;)hy+=hy;function dy(t){if("number"!=typeof t)try{t=ey.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+hy.substring(0,t):ay.throwArgumentError("invalid decimal size","decimals",t)}function fy(t,e){null==e&&(e=0);const n=dy(e),r=(t=ey.from(t)).lt(uy);r&&(t=t.mul(cy));let i=t.mod(n).toString();for(;i.length2&&ay.throwArgumentError("too many decimal points","value",t);let o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>n.length-1&&ly("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.lengthnull==t[e]?r:(typeof t[e]!==n&&ay.throwArgumentError("invalid fixed format ("+e+" not "+n+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),n=i("width","number",n),r=i("decimals","number",r)}return n%8&&ay.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),r>80&&ay.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",r),new yy(sy,e,n,r)}}class my{constructor(t,e,n,r){t!==sy&&ay.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Lp.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=e,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&ay.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=py(this._value,this.format.decimals),n=py(t._value,t.format.decimals);return my.fromValue(e.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=py(this._value,this.format.decimals),n=py(t._value,t.format.decimals);return my.fromValue(e.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=py(this._value,this.format.decimals),n=py(t._value,t.format.decimals);return my.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=py(this._value,this.format.decimals),n=py(t._value,t.format.decimals);return my.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=my.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(e=e.subUnsafe(gy.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=my.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(e=e.addUnsafe(gy.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&ay.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const n=my.from("1"+hy.substring(0,t),this.format),r=vy.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(r).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){if(null==t)return this._hex;t%8&&ay.throwArgumentError("invalid byte width","width",t);return Gp(ey.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return my.fromString(this._value,t)}static fromValue(t,e,n){return null!=n||null==e||function(t){return null!=t&&(ey.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||Up(t)||"bigint"==typeof t||zp(t))}(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),my.fromString(fy(t,e),yy.from(n))}static fromString(t,e){null==e&&(e="fixed");const n=yy.from(e),r=py(t,n.decimals);!n.signed&&r.lt(uy)&&ly("unsigned value cannot be negative","overflow","value",t);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=Gp(i,n.width/8));const o=fy(r,n.decimals);return new my(sy,i,o,n)}static fromBytes(t,e){null==e&&(e="fixed");const n=yy.from(e);if(Pp(t).length>n.width/8)throw new Error("overflow");let r=ey.from(t);n.signed&&(r=r.fromTwos(n.width));const i=r.toTwos((n.signed?0:1)+n.width).toHexString(),o=fy(r,n.decimals);return new my(sy,i,o,n)}static from(t,e){if("string"==typeof t)return my.fromString(t,e);if(zp(t))return my.fromBytes(t,e);try{return my.fromValue(t,0,e)}catch(t){if(t.code!==Lp.errors.INVALID_ARGUMENT)throw t}return ay.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const gy=my.from(1),vy=my.from("0.5");var wy=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const by=new Lp("properties/5.7.0");function My(t,e,n){Object.defineProperty(t,e,{enumerable:!0,value:n,writable:!1})}function Ay(t,e){for(let n=0;n<32;n++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function Ny(t){return wy(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const n=t[e];return Promise.resolve(n).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function Iy(t){const e={};for(const n in t)e[n]=t[n];return e}const Ey={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function xy(t){if(null==t||Ey[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let n=0;nTy(t))));if("object"==typeof t){const e={};for(const n in t){const r=t[n];void 0!==r&&My(e,n,Ty(r))}return e}return by.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Ty(t){return ky(t)}class Ly{constructor(t){for(const e in t)this[e]=Ty(t[e])}}const Sy="abi/5.7.0",jy=new Lp(Sy),Cy={};let Dy={calldata:!0,memory:!0,storage:!0},Oy={calldata:!0,memory:!0};function zy(t,e){if("bytes"===t||"string"===t){if(Dy[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&Oy[e])return!0;return(Dy[e]||"payable"===e)&&jy.throwArgumentError("invalid modifier","name",e),!1}function Py(t,e){for(let n in e)My(t,n,e[n])}const _y=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),By=new RegExp(/^(.*)\[([0-9]*)\]$/);class Ry{constructor(t,e){t!==Cy&&jy.throwError("use fromString",Lp.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Py(this,e);let n=this.type.match(By);Py(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:Ry.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=_y.sighash),_y[t]||jy.throwArgumentError("invalid format type","format",t),t===_y.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==_y.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===_y.full?", ":",")+")"):e+=this.type,t!==_y.sighash&&(!0===this.indexed&&(e+=" indexed"),t===_y.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Ry.fromString(t,e):Ry.fromObject(t)}static fromObject(t){return Ry.isParamType(t)?t:new Ry(Cy,{name:t.name||null,type:Jy(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Ry.fromObject):null})}static fromString(t,e){return n=function(t,e){let n=t;function r(e){jy.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(t){let n={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(n.indexed=!1),n}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},a=o;for(let n=0;nRy.fromString(t,e)))}class Qy{constructor(t,e){t!==Cy&&jy.throwError("use a static from method",Lp.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Py(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return Qy.isFragment(t)?t:"string"==typeof t?Qy.fromString(t):Qy.fromObject(t)}static fromObject(t){if(Qy.isFragment(t))return t;switch(t.type){case"function":return Gy.fromObject(t);case"event":return Yy.fromObject(t);case"constructor":return Hy.fromObject(t);case"error":return Zy.fromObject(t);case"fallback":case"receive":return null}return jy.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Yy.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?Gy.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Hy.fromString(t.trim()):"error"===t.split(" ")[0]?Zy.fromString(t.substring(5).trim()):jy.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class Yy extends Qy{format(t){if(t||(t=_y.sighash),_y[t]||jy.throwArgumentError("invalid format type","format",t),t===_y.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==_y.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===_y.full?", ":",")+") ",t!==_y.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?Yy.fromString(t):Yy.fromObject(t)}static fromObject(t){if(Yy.isEventFragment(t))return t;"event"!==t.type&&jy.throwArgumentError("invalid event object","value",t);const e={name:Ky(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Ry.fromObject):[],type:"event"};return new Yy(Cy,e)}static fromString(t){let e=t.match($y);e||jy.throwArgumentError("invalid event string","value",t);let n=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":n=!0;break;case"":break;default:jy.warn("unknown modifier: "+t)}})),Yy.fromObject({name:e[1].trim(),anonymous:n,inputs:Uy(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function Wy(t,e){e.gas=null;let n=t.split("@");return 1!==n.length?(n.length>2&&jy.throwArgumentError("invalid human-readable ABI signature","value",t),n[1].match(/^[0-9]+$/)||jy.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=ey.from(n[1]),n[0]):t}function Fy(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function Vy(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&jy.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&jy.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||jy.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&jy.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&jy.throwArgumentError("unable to determine stateMutability","value",t),e}class Hy extends Qy{format(t){if(t||(t=_y.sighash),_y[t]||jy.throwArgumentError("invalid format type","format",t),t===_y.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===_y.sighash&&jy.throwError("cannot format a constructor for sighash",Lp.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===_y.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Hy.fromString(t):Hy.fromObject(t)}static fromObject(t){if(Hy.isConstructorFragment(t))return t;"constructor"!==t.type&&jy.throwArgumentError("invalid constructor object","value",t);let e=Vy(t);e.constant&&jy.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Ry.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?ey.from(t.gas):null};return new Hy(Cy,n)}static fromString(t){let e={type:"constructor"},n=(t=Wy(t,e)).match($y);return n&&"constructor"===n[1].trim()||jy.throwArgumentError("invalid constructor string","value",t),e.inputs=Uy(n[2].trim(),!1),Fy(n[3].trim(),e),Hy.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class Gy extends Hy{format(t){if(t||(t=_y.sighash),_y[t]||jy.throwArgumentError("invalid format type","format",t),t===_y.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==_y.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===_y.full?", ":",")+") ",t!==_y.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?Gy.fromString(t):Gy.fromObject(t)}static fromObject(t){if(Gy.isFunctionFragment(t))return t;"function"!==t.type&&jy.throwArgumentError("invalid function object","value",t);let e=Vy(t);const n={type:t.type,name:Ky(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Ry.fromObject):[],outputs:t.outputs?t.outputs.map(Ry.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?ey.from(t.gas):null};return new Gy(Cy,n)}static fromString(t){let e={type:"function"},n=(t=Wy(t,e)).split(" returns ");n.length>2&&jy.throwArgumentError("invalid function string","value",t);let r=n[0].match($y);if(r||jy.throwArgumentError("invalid function signature","value",t),e.name=r[1].trim(),e.name&&Ky(e.name),e.inputs=Uy(r[2],!1),Fy(r[3].trim(),e),n.length>1){let r=n[1].match($y);""==r[1].trim()&&""==r[3].trim()||jy.throwArgumentError("unexpected tokens","value",t),e.outputs=Uy(r[2],!1)}else e.outputs=[];return Gy.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function qy(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||jy.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class Zy extends Qy{format(t){if(t||(t=_y.sighash),_y[t]||jy.throwArgumentError("invalid format type","format",t),t===_y.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==_y.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===_y.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?Zy.fromString(t):Zy.fromObject(t)}static fromObject(t){if(Zy.isErrorFragment(t))return t;"error"!==t.type&&jy.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:Ky(t.name),inputs:t.inputs?t.inputs.map(Ry.fromObject):[]};return qy(new Zy(Cy,e))}static fromString(t){let e={type:"error"},n=t.match($y);return n||jy.throwArgumentError("invalid error signature","value",t),e.name=n[1].trim(),e.name&&Ky(e.name),e.inputs=Uy(n[2],!1),qy(Zy.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function Jy(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const Xy=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ky(t){return t&&t.match(Xy)||jy.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const $y=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const tm=new Lp(Sy);class em{constructor(t,e,n,r){this.name=t,this.type=e,this.localName=n,this.dynamic=r}_throwError(t,e){tm.throwArgumentError(t,this.localName,e)}}class nm{constructor(t){My(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return Vp(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(_p(t._data))}writeBytes(t){let e=Pp(t);const n=e.length%this.wordSize;return n&&(e=_p([e,this._padding.slice(n)])),this._writeData(e)}_getValue(t){let e=Pp(ey.from(t));return e.length>this.wordSize&&tm.throwError("value out-of-bounds",Lp.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=_p([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class rm{constructor(t,e,n,r){My(this,"_data",Pp(t)),My(this,"wordSize",e||32),My(this,"_coerceFunc",n),My(this,"allowLoose",r),this._offset=0}get data(){return Yp(this._data)}get consumed(){return this._offset}static coerce(t,e){let n=t.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):rm.coerce(t,e)}_peekBytes(t,e,n){let r=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&(this.allowLoose&&n&&this._offset+e<=this._data.length?r=e:tm.throwError("data out-of-bounds",Lp.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r})),this._data.slice(this._offset,this._offset+r)}subReader(t){return new rm(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let n=this._peekBytes(0,t,!!e);return this._offset+=n.length,n.slice(0,t)}readValue(){return ey.from(this.readBytes(this.wordSize))}}var im=rp((function(t){!function(){var e="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof k&&k.versions&&k.versions.node?r=ep:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&t.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),u=[4,1024,262144,67108864],c=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],d=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var y=function(t,e,n){return function(r){return new j(t,e,t).update(r)[n]()}},m=function(t,e,n){return function(r,i){return new j(t,e,i).update(r)[n]()}},g=function(t,e,n){return function(e,r,i,o){return A["cshake"+t].update(e,r,i,o)[n]()}},v=function(t,e,n){return function(e,r,i,o){return A["kmac"+t].update(e,r,i,o)[n]()}},w=function(t,e,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function C(t,e,n){j.call(this,t,e,n)}j.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}for(var i,o,s=this.blocks,u=this.byteCount,l=t.length,h=this.blockCount,d=0,f=this.s;d>2]|=t[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(s[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=u){for(this.start=i-u,this.block=s[h],i=0;i>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},j.prototype.encodeString=function(t){var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}var i=0,o=t.length;if(n)i=o;else for(var s=0;s=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},j.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e>4&15]+s[15&t]+s[t>>12&15]+s[t>>8&15]+s[t>>20&15]+s[t>>16&15]+s[t>>28&15]+s[t>>24&15];a%e==0&&(D(n),o=0)}return i&&(t=n[o],u+=s[t>>4&15]+s[15&t],i>1&&(u+=s[t>>12&15]+s[t>>8&15]),i>2&&(u+=s[t>>20&15]+s[t>>16&15])),u},j.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&D(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},C.prototype=new j,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),j.prototype.finalize.call(this)};var D=function(t){var e,n,r,i,o,a,s,u,c,h,d,f,p,y,m,g,v,w,b,M,A,N,I,E,x,k,T,L,S,j,C,D,O,z,P,_,B,R,U,Q,Y,W,F,V,H,G,q,Z,J,X,K,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(h<<1|d>>>31),n=s^(d<<1|h>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=h^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,y=t[0],m=t[1],G=t[11]<<4|t[10]>>>28,q=t[10]<<4|t[11]>>>28,L=t[20]<<3|t[21]>>>29,S=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,W=t[40]<<18|t[41]>>>14,F=t[41]<<18|t[40]>>>14,z=t[2]<<1|t[3]>>>31,P=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,Z=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,j=t[33]<<13|t[32]>>>19,C=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,_=t[14]<<6|t[15]>>>26,B=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,K=t[35]<<15|t[34]>>>17,D=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,E=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,R=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,H=t[9]<<27|t[8]>>>5,k=t[18]<<20|t[19]>>>12,T=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,Q=t[38]<<8|t[39]>>>24,Y=t[39]<<8|t[38]>>>24,N=t[48]<<14|t[49]>>>18,I=t[49]<<14|t[48]>>>18,t[0]=y^~g&w,t[1]=m^~v&b,t[10]=E^~k&L,t[11]=x^~T&S,t[20]=z^~_&R,t[21]=P^~B&U,t[30]=V^~G&Z,t[31]=H^~q&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=g^~w&M,t[3]=v^~b&A,t[12]=k^~L&j,t[13]=T^~S&C,t[22]=_^~R&Q,t[23]=B^~U&Y,t[32]=G^~Z&X,t[33]=q^~J&K,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=w^~M&N,t[5]=b^~A&I,t[14]=L^~j&D,t[15]=S^~C&O,t[24]=R^~Q&W,t[25]=U^~Y&F,t[34]=Z^~X&$,t[35]=J^~K&tt,t[44]=ot^~st&ct,t[45]=at^~ut<,t[6]=M^~N&y,t[7]=A^~I&m,t[16]=j^~D&E,t[17]=C^~O&x,t[26]=Q^~W&z,t[27]=Y^~F&P,t[36]=X^~$&V,t[37]=K^~tt&H,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=N^~y&g,t[9]=I^~m&v,t[18]=D^~E&k,t[19]=O^~x&T,t[28]=W^~z&_,t[29]=F^~P&B,t[38]=$^~V&G,t[39]=tt^~H&q,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=l[r],t[1]^=l[r+1]};if(o)t.exports=A;else for(I=0;I>=8;return e}function um(t,e,n){let r=0;for(let i=0;ie+1+r&&am.throwError("child data too short",Lp.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function dm(t,e){if(0===t.length&&am.throwError("data too short",Lp.errors.BUFFER_OVERRUN,{}),t[e]>=248){const n=t[e]-247;e+1+n>t.length&&am.throwError("data short segment too short",Lp.errors.BUFFER_OVERRUN,{});const r=um(t,e+1,n);return e+1+n+r>t.length&&am.throwError("data long segment too short",Lp.errors.BUFFER_OVERRUN,{}),hm(t,e,e+1+n,n+r)}if(t[e]>=192){const n=t[e]-192;return e+1+n>t.length&&am.throwError("data array too short",Lp.errors.BUFFER_OVERRUN,{}),hm(t,e,e+1,n)}if(t[e]>=184){const n=t[e]-183;e+1+n>t.length&&am.throwError("data array too short",Lp.errors.BUFFER_OVERRUN,{});const r=um(t,e+1,n);e+1+n+r>t.length&&am.throwError("data array too short",Lp.errors.BUFFER_OVERRUN,{});return{consumed:1+n+r,result:Yp(t.slice(e+1+n,e+1+n+r))}}if(t[e]>=128){const n=t[e]-128;e+1+n>t.length&&am.throwError("data too short",Lp.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:Yp(t.slice(e+1,e+1+n))}}return{consumed:1,result:Yp(t[e])}}function fm(t){const e=Pp(t),n=dm(e,0);return n.consumed!==e.length&&am.throwArgumentError("invalid rlp data","data",t),n.result}const pm=new Lp("address/5.7.0");function ym(t){Up(t,20)||pm.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let t=0;t<40;t++)n[t]=e[t].charCodeAt(0);const r=Pp(om(n));for(let t=0;t<40;t+=2)r[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&r[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const mm={};for(let t=0;t<10;t++)mm[String(t)]=String(t);for(let t=0;t<26;t++)mm[String.fromCharCode(65+t)]=String(10+t);const gm=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function vm(t){let e=null;if("string"!=typeof t&&pm.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=ym(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&pm.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>mm[t])).join("");for(;e.length>=gm;){let t=e.substring(0,gm);e=parseInt(t,10)%97+e.substring(t.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}(t)&&pm.throwArgumentError("bad icap checksum","address",t),n=t.substring(4),e=new Jp(n,36).toString(16);e.length<40;)e="0"+e;e=ym("0x"+e)}else pm.throwArgumentError("invalid address","address",t);var n;return e}function wm(t){let e=null;try{e=vm(t.from)}catch(e){pm.throwArgumentError("missing from address","transaction",t)}return vm(Fp(om(lm([e,Bp(Pp(ey.from(t.nonce).toHexString()))])),12))}class bm extends em{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=vm(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return vm(Gp(t.readValue().toHexString(),20))}}class Mm extends em{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const Am=new Lp(Sy);function Nm(t,e,n){let r=null;if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let t={};r=e.map((e=>{const r=e.localName;return r||Am.throwError("cannot encode object for signature with missing names",Lp.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[r]&&Am.throwError("cannot encode object for signature with duplicate names",Lp.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[r]=!0,n[r]}))}else Am.throwArgumentError("invalid tuple value","tuple",n);e.length!==r.length&&Am.throwArgumentError("types/value length mismatch","tuple",n);let i=new nm(t.wordSize),o=new nm(t.wordSize),a=[];e.forEach(((t,e)=>{let n=r[e];if(t.dynamic){let e=o.length;t.encode(o,n);let r=i.writeUpdatableValue();a.push((t=>{r(t+e)}))}else t.encode(i,n)})),a.forEach((t=>{t(i.length)}));let s=t.appendWriter(i);return s+=t.appendWriter(o),s}function Im(t,e){let n=[],r=t.subReader(0);e.forEach((e=>{let i=null;if(e.dynamic){let n=t.readValue(),o=r.subReader(n.toNumber());try{i=e.decode(o)}catch(t){if(t.code===Lp.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===Lp.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&n.push(i)}));const i=e.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});e.forEach(((t,e)=>{let r=t.localName;if(!r||1!==i[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const o=n[e];o instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw o}}):n[r]=o}));for(let t=0;t{throw e}})}return Object.freeze(n)}class Em extends em{constructor(t,e,n){super("array",t.type+"["+(e>=0?e:"")+"]",n,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let n=0;nt._data.length&&Am.throwError("insufficient data length",Lp.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let n=[];for(let t=0;t>6==2;r++)t++;return t}return t===Bm.OVERRUN?n.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(_m||(_m={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Bm||(Bm={}));const Um=Object.freeze({error:function(t,e,n,r,i){return Pm.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",n)},ignore:Rm,replace:function(t,e,n,r,i){return t===Bm.OVERLONG?(r.push(i),0):(r.push(65533),Rm(t,e,n))}});function Qm(t,e){null==e&&(e=Um.error),t=Pp(t);const n=[];let r=0;for(;r>7==0){n.push(i);continue}let o=null,a=null;if(192==(224&i))o=1,a=127;else if(224==(240&i))o=2,a=2047;else{if(240!=(248&i)){r+=e(128==(192&i)?Bm.UNEXPECTED_CONTINUE:Bm.BAD_PREFIX,r-1,t,n);continue}o=3,a=65535}if(r-1+o>=t.length){r+=e(Bm.OVERRUN,r-1,t,n);continue}let s=i&(1<<8-o-1)-1;for(let i=0;i1114111?r+=e(Bm.OUT_OF_RANGE,r-1-o,t,n,s):s>=55296&&s<=57343?r+=e(Bm.UTF16_SURROGATE,r-1-o,t,n,s):s<=a?r+=e(Bm.OVERLONG,r-1-o,t,n,s):n.push(s))}return n}function Ym(t,e=_m.current){e!=_m.current&&(Pm.checkNormalize(),t=t.normalize(e));let n=[];for(let e=0;e>6|192),n.push(63&r|128);else if(55296==(64512&r)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&r)<<10)+(1023&i);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return Pp(n)}function Wm(t,e){return Qm(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}class Fm extends km{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Ym(e))}decode(t){return Wm(super.decode(t))}}class Vm extends em{constructor(t,e){let n=!1;const r=[];t.forEach((t=>{t.dynamic&&(n=!0),r.push(t.type)}));super("tuple","tuple("+r.join(",")+")",e,n),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});return this.coders.forEach(((n,r)=>{let i=n.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[r]))})),Object.freeze(t)}encode(t,e){return Nm(t,this.coders,e)}decode(t){return t.coerce(this.name,Im(t,this.coders))}}const Hm=new Lp(Sy),Gm=new RegExp(/^bytes([0-9]*)$/),qm=new RegExp(/^(u?int)([0-9]*)$/);const Zm=new class{constructor(t){My(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new bm(t.name);case"bool":return new xm(t.name);case"string":return new Fm(t.name);case"bytes":return new Tm(t.name);case"array":return new Em(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new Vm((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new Sm(t.name)}let e=t.type.match(qm);if(e){let n=parseInt(e[2]||"256");return(0===n||n>256||n%8!=0)&&Hm.throwArgumentError("invalid "+e[1]+" bit length","param",t),new zm(n/8,"int"===e[1],t.name)}if(e=t.type.match(Gm),e){let n=parseInt(e[1]);return(0===n||n>32)&&Hm.throwArgumentError("invalid bytes length","param",t),new Lm(n,t.name)}return Hm.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new rm(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new nm(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(Ry.from(t))));return new Vm(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&Hm.throwError("types/values length mismatch",Lp.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const n=t.map((t=>this._getCoder(Ry.from(t)))),r=new Vm(n,"_"),i=this._getWriter();return r.encode(i,e),i.data}decode(t,e,n){const r=t.map((t=>this._getCoder(Ry.from(t))));return new Vm(r,"_").decode(this._getReader(Pp(e),n))}};function Jm(t){return om(Ym(t))}const Xm="hash/5.7.0";function Km(t){t=atob(t);const e=[];for(let n=0;n0&&Array.isArray(t)?i(t,e-1):n.push(t)}))};return i(t,e),n}function eg(t){return function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),i=1,o=[0,1];for(let t=1;t>--u&1}const h=Math.pow(2,31),d=h>>>1,f=d>>1,p=h-1;let y=0;for(let t=0;t<31;t++)y=y<<1|l();let m=[],g=0,v=h;for(;;){let t=Math.floor(((y-g+1)*i-1)/v),e=0,n=r;for(;n-e>1;){let r=e+n>>>1;t>>1|l(),a=a<<1^d,s=(s^d)<<1|d|1;g=a,v=1+s-a}let w=r-4;return m.map((e=>{switch(e-w){case 3:return w+65792+(t[s++]<<16|t[s++]<<8|t[s++]);case 2:return w+256+(t[s++]<<8|t[s++]);case 1:return w+t[s++];default:return e-1}}))}(t))}function ng(t){return 1&t?~t>>1:t>>1}function rg(t,e){let n=Array(t);for(let r=0,i=-1;re[t])):n}function ag(t,e,n){let r=Array(t).fill(void 0).map((()=>[]));for(let i=0;ir[e].push(t)));return r}function sg(t,e){let n=1+e(),r=e(),i=function(t){let e=[];for(;;){let n=t();if(0==n)break;e.push(n)}return e}(e);return tg(ag(i.length,1+t,e).map(((t,e)=>{const o=t[0],a=t.slice(1);return Array(i[e]).fill(void 0).map(((t,e)=>{let i=e*r;return[o+e*n,a.map((t=>t+i))]}))})))}function ug(t,e){return ag(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}const cg=eg(Km("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),lg=new Set(og(cg)),hg=new Set(og(cg)),dg=function(t){let e=[];for(;;){let n=t();if(0==n)break;e.push(sg(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(ug(n,t))}return function(t){const e={};for(let n=0;nt-e));return function n(){let r=[];for(;;){let i=og(t,e);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort(((t,e)=>e.set.size-t.set.size));let i=t(),o=i%3;i=i/3|0;let a=!!(1&i);return i>>=1,{branches:r,valid:o,fe0f:a,save:1==i,check:2==i}}()}(cg);function pg(t){return function(t,e=_m.current){return Qm(Ym(t,e))}(t)}function yg(t){return t.filter((t=>65039!=t))}function mg(t){for(let e of t.split(".")){let t=pg(e);try{for(let e=t.lastIndexOf(95)-1;e>=0;e--)if(95!==t[e])throw new Error("underscore only allowed at start");if(t.length>=4&&t.every((t=>t<128))&&45===t[2]&&45===t[3])throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${e}": ${t.message}`)}}return t}function gg(t){return mg(function(t,e){let n=pg(t).reverse(),r=[];for(;n.length;){let t=vg(n);if(t){r.push(...e(t));continue}let i=n.pop();if(lg.has(i)){r.push(i);continue}if(hg.has(i))continue;let o=dg[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);r.push(...o)}return mg(function(t){return t.normalize("NFC")}(String.fromCodePoint(...r)))}(t,yg))}function vg(t,e){var n;let r,i,o=fg,a=[],s=t.length;for(e&&(e.length=0);s;){let u=t[--s];if(o=null===(n=o.branches.find((t=>t.set.has(u))))||void 0===n?void 0:n.node,!o)break;if(o.save)i=u;else if(o.check&&u===i)break;a.push(u),o.fe0f&&(a.push(65039),s>0&&65039==t[s-1]&&s--),o.valid&&(r=a.slice(),2==o.valid&&r.splice(1,1),e&&e.push(...t.slice(s).reverse()),t.length=s)}return r}const wg=new Lp(Xm),bg=new Uint8Array(32);function Mg(t){if(0===t.length)throw new Error("invalid ENS name; empty component");return t}function Ag(t){const e=Ym(gg(t)),n=[];if(0===t.length)return n;let r=0;for(let t=0;t=e.length)throw new Error("invalid ENS name; empty component");return n.push(Mg(e.slice(r))),n}function Ng(t){"string"!=typeof t&&wg.throwArgumentError("invalid ENS name; not a string","name",t);let e=bg;const n=Ag(t);for(;n.length;)e=om(_p([e,om(n.pop())]));return Yp(e)}bg.fill(0);var Ig=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const Eg=new Lp(Xm),xg=new Uint8Array(32);xg.fill(0);const kg=ey.from(-1),Tg=ey.from(0),Lg=ey.from(1),Sg=ey.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const jg=Gp(Lg.toHexString(),32),Cg=Gp(Tg.toHexString(),32),Dg={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Og=["name","version","chainId","verifyingContract","salt"];function zg(t){return function(e){return"string"!=typeof e&&Eg.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Pg={name:zg("name"),version:zg("version"),chainId:function(t){try{return ey.from(t).toString()}catch(t){}return Eg.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return vm(t).toLowerCase()}catch(t){}return Eg.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=Pp(t);if(32!==e.length)throw new Error("bad length");return Yp(e)}catch(t){}return Eg.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function _g(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const n=""===e[1],r=parseInt(e[2]||"256");(r%8!=0||r>256||e[2]&&e[2]!==String(r))&&Eg.throwArgumentError("invalid numeric width","type",t);const i=Sg.mask(n?r-1:r),o=n?i.add(Lg).mul(kg):Tg;return function(e){const n=ey.from(e);return(n.lt(o)||n.gt(i))&&Eg.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),Gp(n.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return(0===n||n>32||e[1]!==String(n))&&Eg.throwArgumentError("invalid bytes width","type",t),function(e){return Pp(e).length!==n&&Eg.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=Pp(t),n=e.length%32;return n?Vp([e,xg.slice(n)]):Yp(e)}(e)}}}switch(t){case"address":return function(t){return Gp(vm(t),32)};case"bool":return function(t){return t?jg:Cg};case"bytes":return function(t){return om(t)};case"string":return function(t){return Jm(t)}}return null}function Bg(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class Rg{constructor(t){My(this,"types",Object.freeze(Ty(t))),My(this,"_encoderCache",{}),My(this,"_types",{});const e={},n={},r={};Object.keys(t).forEach((t=>{e[t]={},n[t]=[],r[t]={}}));for(const r in t){const i={};t[r].forEach((o=>{i[o.name]&&Eg.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(r)}`,"types",t),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===r&&Eg.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t);_g(a)||(n[a]||Eg.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",t),n[a].push(r),e[r][a]=!0)}))}const i=Object.keys(n).filter((t=>0===n[t].length));0===i.length?Eg.throwArgumentError("missing primary type","types",t):i.length>1&&Eg.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),My(this,"primaryType",i[0]),function i(o,a){a[o]&&Eg.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),a[o]=!0,Object.keys(e[o]).forEach((t=>{n[t]&&(i(t,a),Object.keys(a).forEach((e=>{r[e][t]=!0})))})),delete a[o]}(this.primaryType,{});for(const e in r){const n=Object.keys(r[e]);n.sort(),this._types[e]=Bg(e,t[e])+n.map((e=>Bg(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=_g(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],n=this.getEncoder(t),r=parseInt(e[3]);return e=>{r>=0&&e.length!==r&&Eg.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(n);return this._types[t]&&(i=i.map(om)),om(Vp(i))}}const n=this.types[t];if(n){const e=Jm(this._types[t]);return t=>{const r=n.map((({name:e,type:n})=>{const r=this.getEncoder(n)(t[e]);return this._types[n]?om(r):r}));return r.unshift(e),Vp(r)}}return Eg.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||Eg.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return om(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,n){if(_g(t))return n(t,e);const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const t=r[1],i=parseInt(r[3]);return i>=0&&e.length!==i&&Eg.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,n)))}const i=this.types[t];return i?i.reduce(((t,{name:r,type:i})=>(t[r]=this._visit(i,e[r],n),t)),{}):Eg.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new Rg(t)}static getPrimaryType(t){return Rg.from(t).primaryType}static hashStruct(t,e,n){return Rg.from(e).hashStruct(t,n)}static hashDomain(t){const e=[];for(const n in t){const r=Dg[n];r||Eg.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),e.push({name:n,type:r})}return e.sort(((t,e)=>Og.indexOf(t.name)-Og.indexOf(e.name))),Rg.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,n){return Vp(["0x1901",Rg.hashDomain(t),Rg.from(e).hash(n)])}static hash(t,e,n){return om(Rg.encode(t,e,n))}static resolveNames(t,e,n,r){return Ig(this,void 0,void 0,(function*(){t=Iy(t);const i={};t.verifyingContract&&!Up(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=Rg.from(e);o.visit(n,((t,e)=>("address"!==t||Up(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield r(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),n=o.visit(n,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:n}}))}static getPayload(t,e,n){Rg.hashDomain(t);const r={},i=[];Og.forEach((e=>{const n=t[e];null!=n&&(r[e]=Pg[e](n),i.push({name:e,type:Dg[e]}))}));const o=Rg.from(e),a=Iy(e);return a.EIP712Domain?Eg.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):a.EIP712Domain=i,o.encode(n),{types:a,domain:r,primaryType:o.primaryType,message:o.visit(n,((t,e)=>{if(t.match(/^bytes(\d*)/))return Yp(Pp(e));if(t.match(/^u?int/))return ey.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&Eg.throwArgumentError("invalid string","value",e),e}return Eg.throwArgumentError("unsupported type","type",t)}))}}}const Ug=new Lp(Sy);class Qg extends Ly{}class Yg extends Ly{}class Wg extends Ly{}class Fg extends Ly{static isIndexed(t){return!(!t||!t._isIndexed)}}const Vg={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Hg(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return n.error=e,n}class Gg{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,My(this,"fragments",e.map((t=>Qy.from(t))).filter((t=>null!=t))),My(this,"_abiCoder",Ay(new.target,"getAbiCoder")()),My(this,"functions",{}),My(this,"errors",{}),My(this,"events",{}),My(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void Ug.warn("duplicate definition - constructor"):void My(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let n=t.format();e[n]?Ug.warn("duplicate definition - "+n):e[n]=t})),this.deploy||My(this,"deploy",Hy.from({payable:!1,type:"constructor"})),My(this,"_isInterface",!0)}format(t){t||(t=_y.full),t===_y.sighash&&Ug.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===_y.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return Zm}static getAddress(t){return vm(t)}static getSighash(t){return Fp(Jm(t.format()),0,4)}static getEventTopic(t){return Jm(t.format())}getFunction(t){if(Up(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];Ug.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===n.length?Ug.throwArgumentError("no matching function","name",e):n.length>1&&Ug.throwArgumentError("multiple matching functions","name",e),this.functions[n[0]]}const e=this.functions[Gy.fromString(t).format()];return e||Ug.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(Up(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];Ug.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===n.length?Ug.throwArgumentError("no matching event","name",e):n.length>1&&Ug.throwArgumentError("multiple matching events","name",e),this.events[n[0]]}const e=this.events[Yy.fromString(t).format()];return e||Ug.throwArgumentError("no matching event","signature",t),e}getError(t){if(Up(t)){const e=Ay(this.constructor,"getSighash");for(const n in this.errors){if(t===e(this.errors[n]))return this.errors[n]}Ug.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===n.length?Ug.throwArgumentError("no matching error","name",e):n.length>1&&Ug.throwArgumentError("multiple matching errors","name",e),this.errors[n[0]]}const e=this.errors[Gy.fromString(t).format()];return e||Ug.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return Ay(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),Ay(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const n=Pp(e);return Yp(n.slice(0,4))!==this.getSighash(t)&&Ug.throwArgumentError(`data signature does not match error ${t.name}.`,"data",Yp(n)),this._decodeParams(t.inputs,n.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),Yp(_p([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const n=Pp(e);return Yp(n.slice(0,4))!==this.getSighash(t)&&Ug.throwArgumentError(`data signature does not match function ${t.name}.`,"data",Yp(n)),this._decodeParams(t.inputs,n.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),Yp(_p([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let n=Pp(e),r=null,i="",o=null,a=null,s=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,n)}catch(t){}break;case 4:{const t=Yp(n.slice(0,4)),e=Vg[t];if(e)o=this._abiCoder.decode(e.inputs,n.slice(4)),a=e.name,s=e.signature,e.reason&&(r=o[0]),"Error"===a?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===a&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const e=this.getError(t);o=this._abiCoder.decode(e.inputs,n.slice(4)),a=e.name,s=e.format()}catch(t){}break}}return Ug.throwError("call revert exception"+i,Lp.errors.CALL_EXCEPTION,{method:t.format(),data:Yp(e),errorArgs:o,errorName:a,errorSignature:s,reason:r})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),Yp(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&Ug.throwError("too many arguments for "+t.format(),Lp.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let n=[];t.anonymous||n.push(this.getEventTopic(t));const r=(t,e)=>"string"===t.type?Jm(e):"bytes"===t.type?om(Yp(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=ey.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),Gp(Yp(e),32));for(e.forEach(((e,i)=>{let o=t.inputs[i];o.indexed?null==e?n.push(null):"array"===o.baseType||"tuple"===o.baseType?Ug.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?n.push(e.map((t=>r(o,t)))):n.push(r(o,e)):null!=e&&Ug.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const n=[],r=[],i=[];return t.anonymous||n.push(this.getEventTopic(t)),e.length!==t.inputs.length&&Ug.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const a=e[o];if(t.indexed)if("string"===t.type)n.push(Jm(a));else if("bytes"===t.type)n.push(om(a));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");n.push(this._abiCoder.encode([t.type],[a]))}else r.push(t),i.push(a)})),{data:this._abiCoder.encode(r,i),topics:n}}decodeEventLog(t,e,n){if("string"==typeof t&&(t=this.getEvent(t)),null!=n&&!t.anonymous){let e=this.getEventTopic(t);Up(n[0],32)&&n[0].toLowerCase()===e||Ug.throwError("fragment/topic mismatch",Lp.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:n[0]}),n=n.slice(1)}let r=[],i=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(r.push(Ry.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(r.push(t),o.push(!1)):(i.push(t),o.push(!1))}));let a=null!=n?this._abiCoder.decode(r,_p(n)):null,s=this._abiCoder.decode(i,e,!0),u=[],c=0,l=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==a)u[e]=new Fg({_isIndexed:!0,hash:null});else if(o[e])u[e]=new Fg({_isIndexed:!0,hash:a[l++]});else try{u[e]=a[l++]}catch(t){u[e]=t}else try{u[e]=s[c++]}catch(t){u[e]=t}if(t.name&&null==u[t.name]){const n=u[e];n instanceof Error?Object.defineProperty(u,t.name,{enumerable:!0,get:()=>{throw Hg(`property ${JSON.stringify(t.name)}`,n)}}):u[t.name]=n}}));for(let t=0;t{throw Hg(`index ${t}`,e)}})}return Object.freeze(u)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new Yg({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:ey.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new Qg({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=Yp(t);let n=this.getError(e.substring(0,10).toLowerCase());return n?new Wg({args:this._abiCoder.decode(n.inputs,"0x"+e.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(t){return!(!t||!t._isInterface)}}var qg=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const Zg=new Lp("abstract-provider/5.7.0");class Jg extends Ly{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class Xg{constructor(){Zg.checkAbstract(new.target,Xg),My(this,"_isProvider",!0)}getFeeData(){return qg(this,void 0,void 0,(function*(){const{block:t,gasPrice:e}=yield Ny({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((t=>null))});let n=null,r=null,i=null;return t&&t.baseFeePerGas&&(n=t.baseFeePerGas,i=ey.from("1500000000"),r=t.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:n,maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:e}}))}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}var Kg=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const $g=new Lp("abstract-signer/5.7.0"),tv=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],ev=[Lp.errors.INSUFFICIENT_FUNDS,Lp.errors.NONCE_EXPIRED,Lp.errors.REPLACEMENT_UNDERPRICED];class nv{constructor(){$g.checkAbstract(new.target,nv),My(this,"_isSigner",!0)}getBalance(t){return Kg(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return Kg(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return Kg(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield Ny(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return Kg(this,void 0,void 0,(function*(){this._checkProvider("call");const n=yield Ny(this.checkTransaction(t));return yield this.provider.call(n,e)}))}sendTransaction(t){return Kg(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),n=yield this.signTransaction(e);return yield this.provider.sendTransaction(n)}))}getChainId(){return Kg(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return Kg(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return Kg(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return Kg(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===tv.indexOf(e)&&$g.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=Iy(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&$g.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return Kg(this,void 0,void 0,(function*(){const e=yield Ny(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>Kg(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&$g.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const n=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!n?0!==e.type&&1!==e.type||!n||$g.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):$g.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(n&&$g.throwError("network does not support EIP-1559",Lp.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):$g.throwError("failed to get consistent fee data",Lp.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(ev.indexOf(t.code)>=0)throw t;return $g.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Lp.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&$g.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield Ny(e)}))}_checkProvider(t){this.provider||$g.throwError("missing provider",Lp.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class rv extends nv{constructor(t,e){super(),My(this,"address",t),My(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{$g.throwError(t,Lp.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new rv(this.address,t)}}var iv=rp((function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:vp.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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];i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.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;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 I(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){I.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return v[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,I),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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,ep)})),ov=av;function av(t,e){if(!t)throw new Error(e||"Assertion failed")}av.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var sv=[],uv=[],cv="undefined"!=typeof Uint8Array?Uint8Array:Array,lv=!1;function hv(){lv=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,n=t.length;e>18&63]+sv[i>>12&63]+sv[i>>6&63]+sv[63&i]);return o.join("")}function fv(t){var e;lv||hv();for(var n=t.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;su?u:s+a));return 1===r?(e=t[n-1],i+=sv[e>>2],i+=sv[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=sv[e>>10],i+=sv[e>>4&63],i+=sv[e<<2&63],i+="="),o.push(i),o.join("")}function pv(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)}function yv(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;t[n+f]=255&a,f+=p,a/=256,c-=8);t[n+f-p]|=128*y}var mv={}.toString,gv=Array.isArray||function(t){return"[object Array]"==mv.call(t)};function vv(){return bv.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function wv(t,e){if(vv()=vv())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+vv().toString(16)+" bytes");return 0|t}function xv(t){return!(null==t||!t._isBuffer)}function kv(t,e){if(xv(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return tw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ew(t).length;default:if(r)return tw(t).length;e=(""+e).toLowerCase(),r=!0}}function Tv(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Wv(this,e,n);case"utf8":case"utf-8":return Rv(this,e,n);case"ascii":return Qv(this,e,n);case"latin1":case"binary":return Yv(this,e,n);case"base64":return Bv(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fv(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function Lv(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Sv(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=bv.from(e,r)),xv(e))return 0===e.length?-1:jv(t,e,n,r,i);if("number"==typeof e)return e&=255,bv.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):jv(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function jv(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function Bv(t,e,n){return 0===e&&n===t.length?fv(t):fv(t.slice(e,n))}function Rv(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(t){var e=t.length;if(e<=Uv)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},bv.prototype.compare=function(t,e,n,r,i){if(!xv(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(r,i),c=t.slice(e,n),l=0;li)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return Cv(this,t,e,n);case"utf8":case"utf-8":return Dv(this,t,e,n);case"ascii":return Ov(this,t,e,n);case"latin1":case"binary":return zv(this,t,e,n);case"base64":return Pv(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _v(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},bv.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Uv=4096;function Qv(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;ir)&&(n=r);for(var i="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function Hv(t,e,n,r,i,o){if(!xv(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function Gv(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i>>8*(r?i:1-i)}function qv(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i>>8*(r?i:3-i)&255}function Zv(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Jv(t,e,n,r,i){return i||Zv(t,0,n,4),yv(t,e,n,r,23,4),n+4}function Xv(t,e,n,r,i){return i||Zv(t,0,n,8),yv(t,e,n,r,52,8),n+8}bv.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),e0&&(i*=256);)r+=this[t+--e]*i;return r},bv.prototype.readUInt8=function(t,e){return e||Vv(t,1,this.length),this[t]},bv.prototype.readUInt16LE=function(t,e){return e||Vv(t,2,this.length),this[t]|this[t+1]<<8},bv.prototype.readUInt16BE=function(t,e){return e||Vv(t,2,this.length),this[t]<<8|this[t+1]},bv.prototype.readUInt32LE=function(t,e){return e||Vv(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},bv.prototype.readUInt32BE=function(t,e){return e||Vv(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},bv.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||Vv(t,e,this.length);for(var r=this[t],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*e)),r},bv.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||Vv(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},bv.prototype.readInt8=function(t,e){return e||Vv(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},bv.prototype.readInt16LE=function(t,e){e||Vv(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},bv.prototype.readInt16BE=function(t,e){e||Vv(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},bv.prototype.readInt32LE=function(t,e){return e||Vv(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},bv.prototype.readInt32BE=function(t,e){return e||Vv(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},bv.prototype.readFloatLE=function(t,e){return e||Vv(t,4,this.length),pv(this,t,!0,23,4)},bv.prototype.readFloatBE=function(t,e){return e||Vv(t,4,this.length),pv(this,t,!1,23,4)},bv.prototype.readDoubleLE=function(t,e){return e||Vv(t,8,this.length),pv(this,t,!0,52,8)},bv.prototype.readDoubleBE=function(t,e){return e||Vv(t,8,this.length),pv(this,t,!1,52,8)},bv.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||Hv(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+n},bv.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,1,255,0),bv.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},bv.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,2,65535,0),bv.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):Gv(this,t,e,!0),e+2},bv.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,2,65535,0),bv.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):Gv(this,t,e,!1),e+2},bv.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,4,4294967295,0),bv.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):qv(this,t,e,!0),e+4},bv.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,4,4294967295,0),bv.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):qv(this,t,e,!1),e+4},bv.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Hv(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+n},bv.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Hv(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},bv.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,1,127,-128),bv.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},bv.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,2,32767,-32768),bv.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):Gv(this,t,e,!0),e+2},bv.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,2,32767,-32768),bv.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):Gv(this,t,e,!1),e+2},bv.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,4,2147483647,-2147483648),bv.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):qv(this,t,e,!0),e+4},bv.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),bv.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):qv(this,t,e,!1),e+4},bv.prototype.writeFloatLE=function(t,e,n){return Jv(this,t,e,!0,n)},bv.prototype.writeFloatBE=function(t,e,n){return Jv(this,t,e,!1,n)},bv.prototype.writeDoubleLE=function(t,e,n){return Xv(this,t,e,!0,n)},bv.prototype.writeDoubleBE=function(t,e,n){return Xv(this,t,e,!1,n)},bv.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=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=0;--i)t[i+e]=this[i+n];else if(o<1e3||!bv.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.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;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function ew(t){return function(t){var e,n,r,i,o,a;lv||hv();var s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new cv(3*s/4-o),r=o>0?s-4:s;var u=0;for(e=0,n=0;e>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=uv[t.charCodeAt(e)]<<2|uv[t.charCodeAt(e+1)]>>4,a[u++]=255&i):1===o&&(i=uv[t.charCodeAt(e)]<<10|uv[t.charCodeAt(e+1)]<<4|uv[t.charCodeAt(e+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Kv,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function nw(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function rw(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var iw=function(t){return t instanceof bv},ow=rp((function(t,e){var n=/%[sdj%]/g;e.format=function(t){if(!y(t)){for(var e=[],r=0;r=a)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(n)?r.showHidden=n:n&&e._extend(r,n),m(r.showHidden)&&(r.showHidden=!1),m(r.depth)&&(r.depth=2),m(r.colors)&&(r.colors=!1),m(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),u(r,t,r.depth)}function a(t,e){var n=o.styles[e];return n?"["+o.colors[n][0]+"m"+t+"["+o.colors[n][1]+"m":t}function s(t,e){return t}function u(t,n,r){if(t.customInspect&&n&&M(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,t);return y(i)||(i=u(t,i,r)),i}var o=function(t,e){if(m(e))return t.stylize("undefined","undefined");if(y(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}if(p(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(f(e))return t.stylize("null","null")}(t,n);if(o)return o;var a=Object.keys(n),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(n)),0===a.length){if(M(n)){var v=n.name?": "+n.name:"";return t.stylize("[Function"+v+"]","special")}if(g(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(w(n))return t.stylize(Date.prototype.toString.call(n),"date");if(b(n))return c(n)}var A,N="",I=!1,E=["{","}"];(h(n)&&(I=!0,E=["[","]"]),M(n))&&(N=" [Function"+(n.name?": "+n.name:"")+"]");return g(n)&&(N=" "+RegExp.prototype.toString.call(n)),w(n)&&(N=" "+Date.prototype.toUTCString.call(n)),b(n)&&(N=" "+c(n)),0!==a.length||I&&0!=n.length?r<0?g(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special"):(t.seen.push(n),A=I?function(t,e,n,r,i){for(var o=[],a=0,s=e.length;a60)return n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1];return n[0]+e+" "+t.join(", ")+" "+n[1]}(A,N,E)):E[0]+N+E[1]}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function l(t,e,n,r,i,o){var a,s,c;if((c=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(s=t.stylize("[Setter]","special")),x(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(c.value)<0?(s=f(n)?u(t,c.value,null):u(t,c.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),m(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function h(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function f(t){return null===t}function p(t){return"number"==typeof t}function y(t){return"string"==typeof t}function m(t){return void 0===t}function g(t){return v(t)&&"[object RegExp]"===A(t)}function v(t){return"object"==typeof t&&null!==t}function w(t){return v(t)&&"[object Date]"===A(t)}function b(t){return v(t)&&("[object Error]"===A(t)||t instanceof Error)}function M(t){return"function"==typeof t}function A(t){return Object.prototype.toString.call(t)}function N(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(m(r)&&(r=k.env.NODE_DEBUG||""),t=t.toUpperCase(),!i[t])if(new RegExp("\\b"+t+"\\b","i").test(r)){var n=k.pid;i[t]=function(){var r=e.format.apply(e,arguments);console.error("%s %d: %s",t,n,r)}}else i[t]=function(){};return i[t]},e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=h,e.isBoolean=d,e.isNull=f,e.isNullOrUndefined=function(t){return null==t},e.isNumber=p,e.isString=y,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=m,e.isRegExp=g,e.isObject=v,e.isDate=w,e.isError=b,e.isFunction=M,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=iw;var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function E(){var t=new Date,e=[N(t.getHours()),N(t.getMinutes()),N(t.getSeconds())].join(":");return[t.getDate(),I[t.getMonth()],e].join(" ")}function x(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",E(),e.format.apply(e,arguments))},e.inherits=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})},e._extend=function(t,e){if(!e||!v(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}})),aw=rp((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}}));function sw(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function uw(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function cw(t){return 1===t.length?"0"+t:t}function lw(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}var hw={inherits:rp((function(t){try{var e=ow;if("function"!=typeof e.inherits)throw"";t.exports=e.inherits}catch(e){t.exports=aw}})),toArray:function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,n[r++]=63&o|128):sw(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i>>0}return o},split32:function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},rotr32:function(t,e){return t>>>e|t<<32-e},rotl32:function(t,e){return t<>>32-e},sum32:function(t,e){return t+e>>>0},sum32_3:function(t,e,n){return t+e+n>>>0},sum32_4:function(t,e,n,r){return t+e+n+r>>>0},sum32_5:function(t,e,n,r,i){return t+e+n+r+i>>>0},sum64:function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o>>0,t[e+1]=o},sum64_hi:function(t,e,n,r){return(e+r>>>0>>0},sum64_lo:function(t,e,n,r){return e+r>>>0},sum64_4_hi:function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)>>0)>>0)>>0},sum64_4_lo:function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},sum64_5_hi:function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)>>0)>>0)>>0)>>0},sum64_5_lo:function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},rotr64_hi:function(t,e,n){return(e<<32-n|t>>>n)>>>0},rotr64_lo:function(t,e,n){return(t<<32-n|e>>>n)>>>0},shr64_hi:function(t,e,n){return t>>>n},shr64_lo:function(t,e,n){return(t<<32-n|e>>>n)>>>0}};function dw(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var fw=dw;dw.prototype.update=function(t,e){if(t=hw.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=hw.join32(t,0,t.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},g1_256:function(t){return yw(t,17)^yw(t,19)^t>>>10}},bw=hw.rotl32,Mw=hw.sum32,Aw=hw.sum32_5,Nw=ww.ft_1,Iw=pw.BlockHash,Ew=[1518500249,1859775393,2400959708,3395469782];function xw(){if(!(this instanceof xw))return new xw;Iw.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}hw.inherits(xw,Iw);var kw=xw;xw.blockSize=512,xw.outSize=160,xw.hmacStrength=80,xw.padLength=64,xw.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;rthis.blockSize&&(t=(new this.Hash).update(t).digest()),ov(t.length<=this.blockSize);for(var e=t.length;e>8,a=255&i;o?n.push(o,a):n.push(a)}return n},n.zero2=r,n.toHex=i,n.encode=function(t,e){return"hex"===e?i(t):t}})),Qb=_b((function(t,e){var n=e;n.assert=Bb,n.toArray=Ub.toArray,n.zero2=Ub.zero2,n.toHex=Ub.toHex,n.encode=Ub.encode,n.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},n.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0==(1&c)?0:3!==(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},n.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new iv(t,"hex","le")}})),Yb=Qb.getNAF,Wb=Qb.getJSF,Fb=Qb.assert;function Vb(t,e){this.type=t,this.p=new iv(e.p,16),this.red=e.prime?iv.red(e.prime):iv.mont(this.p),this.zero=new iv(0).toRed(this.red),this.one=new iv(1).toRed(this.red),this.two=new iv(2).toRed(this.red),this.n=e.n&&new iv(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hb=Vb;function Gb(t,e){this.curve=t,this.type=e,this.precomputed=null}Vb.prototype.point=function(){throw new Error("Not implemented")},Vb.prototype.validate=function(){throw new Error("Not implemented")},Vb.prototype._fixedNafMul=function(t,e){Fb(t.precomputed);var n=t._getDoubles(),r=Yb(e,1,this._bitLength),i=(1<=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];Fb(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},Vb.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var y=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(y[1]=e[f].add(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].add(e[p].neg())):(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=Wb(n[f],n[p]);for(h=Math.max(g[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a=0;o--){for(var A=0;o>=0;){var N=!0;for(a=0;a=0&&A++,b=b.dblp(A),o<0)break;for(a=0;a0?s=c[a][I-1>>1]:I<0&&(s=c[a][-I-1>>1].neg()),b="affine"===s.type?b.mixedAdd(s):b.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},Gb.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},Jb.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},Jb.prototype.pointFromX=function(t,e){(t=new iv(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},Jb.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Jb.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},Kb.prototype.isInfinity=function(){return this.inf},Kb.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},Kb.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Kb.prototype.getX=function(){return this.x.fromRed()},Kb.prototype.getY=function(){return this.y.fromRed()},Kb.prototype.mul=function(t){return t=new iv(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Kb.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},Kb.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},Kb.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Kb.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},Kb.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},qb($b,Hb.BasePoint),Jb.prototype.jpoint=function(t,e,n){return new $b(this,t,e,n)},$b.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},$b.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$b.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},$b.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},$b.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},$b.prototype.inspect=function(){return this.isInfinity()?"":""},$b.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var tM=_b((function(t,e){var n=e;n.base=Hb,n.short=Xb,n.mont=null,n.edwards=null})),eM=_b((function(t,e){var n,r=e,i=Qb.assert;function o(t){"short"===t.type?this.curve=new tM.short(t):"edwards"===t.type?this.curve=new tM.edwards(t):this.curve=new tM.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new o(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Pb.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Pb.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Pb.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Pb.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Pb.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Pb.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Pb.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(t){n=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Pb.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function nM(t){if(!(this instanceof nM))return new nM(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Ub.toArray(t.entropy,t.entropyEnc||"hex"),n=Ub.toArray(t.nonce,t.nonceEnc||"hex"),r=Ub.toArray(t.pers,t.persEnc||"hex");Bb(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var rM=nM;nM.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},nM.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=Ub.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var sM=Qb.assert;function uM(t,e){if(t instanceof uM)return t;this._importDER(t,e)||(sM(t.r&&t.s,"Signature without r or s"),this.r=new iv(t.r,16),this.s=new iv(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var cM=uM;function lM(){this.place=0}function hM(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o>>=0;return!(i<=127)&&(e.place=a,i)}function dM(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}uM.prototype._importDER=function(t,e){t=Qb.toArray(t,e);var n=new lM;if(48!==t[n.place++])return!1;var r=hM(t,n);if(!1===r)return!1;if(r+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var i=hM(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=hM(t,n);if(!1===a)return!1;if(t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new iv(o),this.s=new iv(s),this.recoveryParam=null,!0},uM.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=dM(e),n=dM(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];fM(r,e.length),(r=r.concat(e)).push(2),fM(r,n.length);var i=r.concat(n),o=[48];return fM(o,i.length),o=o.concat(i),Qb.encode(o,t)};var pM=function(){throw new Error("unsupported")},yM=Qb.assert;function mM(t){if(!(this instanceof mM))return new mM(t);"string"==typeof t&&(yM(Object.prototype.hasOwnProperty.call(eM,t),"Unknown curve "+t),t=eM[t]),t instanceof eM.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var gM=mM;mM.prototype.keyPair=function(t){return new aM(this,t)},mM.prototype.keyFromPrivate=function(t,e){return aM.fromPrivate(this,t,e)},mM.prototype.keyFromPublic=function(t,e){return aM.fromPublic(this,t,e)},mM.prototype.genKeyPair=function(t){t||(t={});for(var e=new rM({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||pM(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new iv(2));;){var i=new iv(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},mM.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},mM.prototype.sign=function(t,e,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new iv(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new rM({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new iv(1)),c=0;;c++){var l=r.k?r.k(c):new iv(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new cM({r:f,s:p,recoveryParam:y})}}}}}},mM.prototype.verify=function(t,e,n,r){t=this._truncateToN(new iv(t,16)),n=this.keyFromPublic(n,r);var i=(e=new cM(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},mM.prototype.recoverPubKey=function(t,e,n,r){yM((3&n)===n,"The recovery param is more than two bits"),e=new cM(e,r);var i=this.n,o=new iv(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},mM.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new cM(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var vM=_b((function(t,e){var n=e;n.version="6.5.4",n.utils=Qb,n.rand=function(){throw new Error("unsupported")},n.curve=tM,n.curves=eM,n.ec=gM,n.eddsa=null})).ec;const wM=new Lp("signing-key/5.7.0");let bM=null;function MM(){return bM||(bM=new vM("secp256k1")),bM}class AM{constructor(t){My(this,"curve","secp256k1"),My(this,"privateKey",Yp(t)),32!==Wp(this.privateKey)&&wM.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=MM().keyFromPrivate(Pp(this.privateKey));My(this,"publicKey","0x"+e.getPublic(!1,"hex")),My(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),My(this,"_isSigningKey",!0)}_addPoint(t){const e=MM().keyFromPublic(Pp(this.publicKey)),n=MM().keyFromPublic(Pp(t));return"0x"+e.pub.add(n.pub).encodeCompressed("hex")}signDigest(t){const e=MM().keyFromPrivate(Pp(this.privateKey)),n=Pp(t);32!==n.length&&wM.throwArgumentError("bad digest length","digest",t);const r=e.sign(n,{canonical:!0});return qp({recoveryParam:r.recoveryParam,r:Gp("0x"+r.r.toString(16),32),s:Gp("0x"+r.s.toString(16),32)})}computeSharedSecret(t){const e=MM().keyFromPrivate(Pp(this.privateKey)),n=MM().keyFromPublic(Pp(NM(t)));return Gp("0x"+e.derive(n.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function NM(t,e){const n=Pp(t);if(32===n.length){const t=new AM(n);return e?"0x"+MM().keyFromPrivate(n).getPublic(!0,"hex"):t.publicKey}return 33===n.length?e?Yp(n):"0x"+MM().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?e?"0x"+MM().keyFromPublic(n).getPublic(!0,"hex"):Yp(n):wM.throwArgumentError("invalid public or private key","key","[REDACTED]")}const IM=new Lp("transactions/5.7.0");var EM;function xM(t){return"0x"===t?null:vm(t)}function kM(t){return"0x"===t?Cm:ey.from(t)}function TM(t,e){return function(t){return vm(Fp(om(Fp(NM(t),1)),12))}(function(t,e){const n=qp(e),r={r:Pp(n.r),s:Pp(n.s)};return"0x"+MM().recoverPubKey(Pp(t),r,n.recoveryParam).encode("hex",!1)}(Pp(t),e))}function LM(t,e){const n=Bp(ey.from(t).toHexString());return n.length>32&&IM.throwArgumentError("invalid length for "+e,"transaction:"+e,t),n}function SM(t,e){return{address:vm(t),storageKeys:(e||[]).map(((e,n)=>(32!==Wp(e)&&IM.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,e),e.toLowerCase())))}}function jM(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&IM.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),SM(t[0],t[1])):SM(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const n=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return SM(e,Object.keys(n).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function CM(t){return jM(t).map((t=>[t.address,t.storageKeys]))}function DM(t,e){if(null!=t.gasPrice){const e=ey.from(t.gasPrice),n=ey.from(t.maxFeePerGas||0);e.eq(n)||IM.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:n})}const n=[LM(t.chainId||0,"chainId"),LM(t.nonce||0,"nonce"),LM(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),LM(t.maxFeePerGas||0,"maxFeePerGas"),LM(t.gasLimit||0,"gasLimit"),null!=t.to?vm(t.to):"0x",LM(t.value||0,"value"),t.data||"0x",CM(t.accessList||[])];if(e){const t=qp(e);n.push(LM(t.recoveryParam,"recoveryParam")),n.push(Bp(t.r)),n.push(Bp(t.s))}return Vp(["0x02",lm(n)])}function OM(t,e){const n=[LM(t.chainId||0,"chainId"),LM(t.nonce||0,"nonce"),LM(t.gasPrice||0,"gasPrice"),LM(t.gasLimit||0,"gasLimit"),null!=t.to?vm(t.to):"0x",LM(t.value||0,"value"),t.data||"0x",CM(t.accessList||[])];if(e){const t=qp(e);n.push(LM(t.recoveryParam,"recoveryParam")),n.push(Bp(t.r)),n.push(Bp(t.s))}return Vp(["0x01",lm(n)])}function zM(t,e,n){try{const n=kM(e[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");t.v=n}catch(t){IM.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=Gp(e[1],32),t.s=Gp(e[2],32);try{const e=om(n(t));t.from=TM(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){}}function PM(t){const e=Pp(t);if(e[0]>127)return function(t){const e=fm(t);9!==e.length&&6!==e.length&&IM.throwArgumentError("invalid raw transaction","rawTransaction",t);const n={nonce:kM(e[0]).toNumber(),gasPrice:kM(e[1]),gasLimit:kM(e[2]),to:xM(e[3]),value:kM(e[4]),data:e[5],chainId:0};if(6===e.length)return n;try{n.v=ey.from(e[6]).toNumber()}catch(t){return n}if(n.r=Gp(e[7],32),n.s=Gp(e[8],32),ey.from(n.r).isZero()&&ey.from(n.s).isZero())n.chainId=n.v,n.v=0;else{n.chainId=Math.floor((n.v-35)/2),n.chainId<0&&(n.chainId=0);let r=n.v-27;const i=e.slice(0,6);0!==n.chainId&&(i.push(Yp(n.chainId)),i.push("0x"),i.push("0x"),r-=2*n.chainId+8);const o=om(lm(i));try{n.from=TM(o,{r:Yp(n.r),s:Yp(n.s),recoveryParam:r})}catch(t){}n.hash=om(t)}return n.type=null,n}(e);switch(e[0]){case 1:return function(t){const e=fm(t.slice(1));8!==e.length&&11!==e.length&&IM.throwArgumentError("invalid component count for transaction type: 1","payload",Yp(t));const n={type:1,chainId:kM(e[0]).toNumber(),nonce:kM(e[1]).toNumber(),gasPrice:kM(e[2]),gasLimit:kM(e[3]),to:xM(e[4]),value:kM(e[5]),data:e[6],accessList:jM(e[7])};return 8===e.length||(n.hash=om(t),zM(n,e.slice(8),OM)),n}(e);case 2:return function(t){const e=fm(t.slice(1));9!==e.length&&12!==e.length&&IM.throwArgumentError("invalid component count for transaction type: 2","payload",Yp(t));const n=kM(e[2]),r=kM(e[3]),i={type:2,chainId:kM(e[0]).toNumber(),nonce:kM(e[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:kM(e[4]),to:xM(e[5]),value:kM(e[6]),data:e[7],accessList:jM(e[8])};return 9===e.length||(i.hash=om(t),zM(i,e.slice(9),DM)),i}(e)}return IM.throwError(`unsupported transaction type: ${e[0]}`,Lp.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(EM||(EM={}));var _M=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const BM=new Lp("contracts/5.7.0");function RM(t,e){return _M(this,void 0,void 0,(function*(){const n=yield e;"string"!=typeof n&&BM.throwArgumentError("invalid address or ENS name","name",n);try{return vm(n)}catch(t){}t||BM.throwError("a provider or signer is needed to resolve ENS names",Lp.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield t.resolveName(n);return null==r&&BM.throwArgumentError("resolver or addr is not configured for ENS name","name",n),r}))}function UM(t,e,n){return _M(this,void 0,void 0,(function*(){return Array.isArray(n)?yield Promise.all(n.map(((n,r)=>UM(t,Array.isArray(e)?e[r]:e[n.name],n)))):"address"===n.type?yield RM(t,e):"tuple"===n.type?yield UM(t,e,n.components):"array"===n.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>UM(t,e,n.arrayChildren)))):Promise.reject(BM.makeError("invalid value for array",Lp.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function QM(t,e,n){return _M(this,void 0,void 0,(function*(){let r={};n.length===e.inputs.length+1&&"object"==typeof n[n.length-1]&&(r=Iy(n.pop())),BM.checkArgumentCount(n.length,e.inputs.length,"passed to contract"),t.signer?r.from?r.from=Ny({override:RM(t.signer,r.from),signer:t.signer.getAddress()}).then((t=>_M(this,void 0,void 0,(function*(){return vm(t.signer)!==t.override&&BM.throwError("Contract with a Signer cannot override from",Lp.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):r.from=t.signer.getAddress():r.from&&(r.from=RM(t.provider,r.from));const i=yield Ny({args:UM(t.signer||t.provider,n,e.inputs),address:t.resolvedAddress,overrides:Ny(r)||{}}),o=t.interface.encodeFunctionData(e,i.args),a={data:o,to:i.address},s=i.overrides;if(null!=s.nonce&&(a.nonce=ey.from(s.nonce).toNumber()),null!=s.gasLimit&&(a.gasLimit=ey.from(s.gasLimit)),null!=s.gasPrice&&(a.gasPrice=ey.from(s.gasPrice)),null!=s.maxFeePerGas&&(a.maxFeePerGas=ey.from(s.maxFeePerGas)),null!=s.maxPriorityFeePerGas&&(a.maxPriorityFeePerGas=ey.from(s.maxPriorityFeePerGas)),null!=s.from&&(a.from=s.from),null!=s.type&&(a.type=s.type),null!=s.accessList&&(a.accessList=jM(s.accessList)),null==a.gasLimit&&null!=e.gas){let t=21e3;const n=Pp(o);for(let e=0;enull!=r[t]));return u.length&&BM.throwError(`cannot override ${u.map((t=>JSON.stringify(t))).join(",")}`,Lp.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),a}))}function YM(t,e,n){const r=t.signer||t.provider;return function(...i){return _M(this,void 0,void 0,(function*(){let o;if(i.length===e.inputs.length+1&&"object"==typeof i[i.length-1]){const t=Iy(i.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,i.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const a=yield QM(t,e,i),s=yield r.call(a,o);try{let r=t.interface.decodeFunctionResult(e,s);return n&&1===e.outputs.length&&(r=r[0]),r}catch(e){throw e.code===Lp.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=i,e.transaction=a),e}}))}}function WM(t,e){return function(...n){return _M(this,void 0,void 0,(function*(){t.signer||BM.throwError("sending a transaction requires a signer",Lp.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const r=yield QM(t,e,n),i=yield t.signer.sendTransaction(r);return function(t,e){const n=e.wait.bind(e);e.wait=e=>n(e).then((e=>(e.events=e.logs.map((n=>{let r=Ty(n),i=null;try{i=t.interface.parseLog(n)}catch(t){}return i&&(r.args=i.args,r.decode=(e,n)=>t.interface.decodeEventLog(i.eventFragment,e,n),r.event=i.name,r.eventSignature=i.signature),r.removeListener=()=>t.provider,r.getBlock=()=>t.provider.getBlock(e.blockHash),r.getTransaction=()=>t.provider.getTransaction(e.transactionHash),r.getTransactionReceipt=()=>Promise.resolve(e),r})),e)))}(t,i),i}))}}function FM(t,e,n){return e.constant?YM(t,e,n):WM(t,e)}function VM(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class HM{constructor(t,e){My(this,"tag",t),My(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((n=>!(!e&&n.listener===t)||(e=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const n=t.slice();return setTimeout((()=>{e.listener.apply(this,n)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class GM extends HM{constructor(){super("error",null)}}class qM extends HM{constructor(t,e,n,r){const i={address:t};let o=e.getEventTopic(n);r?(o!==r[0]&&BM.throwArgumentError("topic mismatch","topics",r),i.topics=r.slice()):i.topics=[o],super(VM(i),i),My(this,"address",t),My(this,"interface",e),My(this,"fragment",n)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=function(t){const e=[],n=function(t,r){if(Array.isArray(r))for(let i in r){const o=t.slice();o.push(i);try{n(o,r[i])}catch(t){e.push({path:o,error:t})}}};return n([],t),e}(t.args);if(e.length)throw e[0].error;const n=(t.args||[]).slice();return n.push(t),n}}class ZM extends HM{constructor(t,e){super("*",{address:t}),My(this,"address",t),My(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,n)=>this.interface.decodeEventLog(e.eventFragment,t,n),t.args=e.args}catch(t){}}}class JM extends class{constructor(t,e,n){My(this,"interface",Ay(new.target,"getInterface")(e)),null==n?(My(this,"provider",null),My(this,"signer",null)):nv.isSigner(n)?(My(this,"provider",n.provider||null),My(this,"signer",n)):Xg.isProvider(n)?(My(this,"provider",n),My(this,"signer",null)):BM.throwArgumentError("invalid signer or provider","signerOrProvider",n),My(this,"callStatic",{}),My(this,"estimateGas",{}),My(this,"functions",{}),My(this,"populateTransaction",{}),My(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const n=this.interface.events[e];My(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(n,t)}))),t[n.name]||(t[n.name]=[]),t[n.name].push(e)})),Object.keys(t).forEach((e=>{const n=t[e];1===n.length?My(this.filters,e,this.filters[n[0]]):BM.warn(`Duplicate definition of ${e} (${n.join(", ")})`)}))}if(My(this,"_runningEvents",{}),My(this,"_wrappedEmits",{}),null==t&&BM.throwArgumentError("invalid contract address or ENS name","addressOrName",t),My(this,"address",t),this.provider)My(this,"resolvedAddress",RM(this.provider,t));else try{My(this,"resolvedAddress",Promise.resolve(vm(t)))}catch(t){BM.throwError("provider is required to use ENS name as contract address",Lp.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((t=>{}));const r={},i={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(i[t])BM.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{i[t]=!0;{const n=e.name;r[`%${n}`]||(r[`%${n}`]=[]),r[`%${n}`].push(t)}null==this[t]&&My(this,t,FM(this,e,!0)),null==this.functions[t]&&My(this.functions,t,FM(this,e,!1)),null==this.callStatic[t]&&My(this.callStatic,t,YM(this,e,!0)),null==this.populateTransaction[t]&&My(this.populateTransaction,t,function(t,e){return function(...n){return QM(t,e,n)}}(this,e)),null==this.estimateGas[t]&&My(this.estimateGas,t,function(t,e){const n=t.signer||t.provider;return function(...r){return _M(this,void 0,void 0,(function*(){n||BM.throwError("estimate require a provider or signer",Lp.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield QM(t,e,r);return yield n.estimateGas(i)}))}}(this,e))}})),Object.keys(r).forEach((t=>{const e=r[t];if(e.length>1)return;t=t.substring(1);const n=e[0];try{null==this[t]&&My(this,t,this[n])}catch(t){}null==this.functions[t]&&My(this.functions,t,this.functions[n]),null==this.callStatic[t]&&My(this.callStatic,t,this.callStatic[n]),null==this.populateTransaction[t]&&My(this.populateTransaction,t,this.populateTransaction[n]),null==this.estimateGas[t]&&My(this.estimateGas,t,this.estimateGas[n])}))}static getContractAddress(t){return wm(t)}static getInterface(t){return Gg.isInterface(t)?t:new Gg(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,t).then((t=>("0x"===t&&BM.throwError("contract not deployed",Lp.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||BM.throwError("sending a transactions require a signer",Lp.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=Iy(t||{});return["from","to"].forEach((function(t){null!=e[t]&&BM.throwError("cannot override "+t,Lp.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new rv(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&My(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return Fg.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new GM);if("event"===t)return this._normalizeRunningEvent(new HM("event",null));if("*"===t)return this._normalizeRunningEvent(new ZM(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new qM(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const n=this.interface.getEvent(e);return this._normalizeRunningEvent(new qM(this.address,this.interface,n,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new HM(VM(e),e))}return this._normalizeRunningEvent(new ZM(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,n){const r=Ty(e);return r.removeListener=()=>{n&&(t.removeListener(n),this._checkRunningEvents(t))},r.getBlock=()=>this.provider.getBlock(e.blockHash),r.getTransaction=()=>this.provider.getTransaction(e.transactionHash),r.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(r),r}_addEventListener(t,e,n){if(this.provider||BM.throwError("events require a provider or a signer with a provider",Lp.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,n),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const n=n=>{let r=this._wrapEvent(t,n,e);if(null==r.decodeError)try{const e=t.getEmit(r);this.emit(t.filter,...e)}catch(t){r.decodeError=t.error}null!=t.filter&&this.emit("event",r),null!=r.decodeError&&this.emit("error",r.decodeError,r)};this._wrappedEmits[t.tag]=n,null!=t.filter&&this.provider.on(t.filter,n)}}queryFilter(t,e,n){const r=this._getRunningEvent(t),i=Iy(r.filter);return"string"==typeof e&&Up(e,32)?(null!=n&&BM.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),i.blockHash=e):(i.fromBlock=null!=e?e:0,i.toBlock=null!=n?n:"latest"),this.provider.getLogs(i).then((t=>t.map((t=>this._wrapEvent(r,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const n=this._getRunningEvent(t),r=n.run(e)>0;return this._checkRunningEvents(n),r}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const n=this._getRunningEvent(t);return n.removeListener(e),this._checkRunningEvents(n),this}removeListener(t,e){return this.off(t,e)}}{}class XM{constructor(t){My(this,"alphabet",t),My(this,"base",t.length),My(this,"_alphabetMap",{}),My(this,"_leader",t.charAt(0));for(let e=0;e0;)n.push(r%this.base),r=r/this.base|0}let r="";for(let t=0;0===e[t]&&t=0;--t)r+=this.alphabet[n[t]];return r}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let n=0;n>=8;for(;i>0;)e.push(255&i),i>>=8}for(let n=0;t[n]===this._leader&&n{o[e.toLowerCase()]=t})):r.headers.keys().forEach((t=>{o[t.toLowerCase()]=r.headers.get(t)})),{headers:o,statusCode:r.status,statusMessage:r.statusText,body:Pp(new Uint8Array(i))}}))}var cA=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const lA=new Lp("web/5.7.1");function hA(t){return new Promise((e=>{setTimeout(e,t)}))}function dA(t,e){if(null==t)return null;if("string"==typeof t)return t;if(Dp(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return Wm(t)}catch(t){}return Yp(t)}return t}function fA(t,e,n){let r=null;if(null!=e){r=Ym(e);const n="string"==typeof t?{url:t}:Iy(t);if(n.headers){0!==Object.keys(n.headers).filter((t=>"content-type"===t.toLowerCase())).length||(n.headers=Iy(n.headers),n.headers["content-type"]="application/json")}else n.headers={"content-type":"application/json"};t=n}return function(t,e,n){const r="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;lA.assertArgument(r>0&&r%1==0,"invalid connection throttle limit","connection.throttleLimit",r);const i="object"==typeof t?t.throttleCallback:null,o="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;lA.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const a="object"==typeof t&&!!t.errorPassThrough,s={};let u=null;const c={method:"GET"};let l=!1,h=12e4;if("string"==typeof t)u=t;else if("object"==typeof t){if(null!=t&&null!=t.url||lA.throwArgumentError("missing URL","connection.url",t),u=t.url,"number"==typeof t.timeout&&t.timeout>0&&(h=t.timeout),t.headers)for(const e in t.headers)s[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(l=!0);if(c.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==u.substring(0,6)&&!0!==t.allowInsecureAuthentication&&lA.throwError("basic authentication requires a secure https url",Lp.errors.INVALID_ARGUMENT,{argument:"url",url:u,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;s.authorization={key:"Authorization",value:"Basic "+$m(Ym(e))}}null!=t.skipFetchSetup&&(c.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(c.fetchOptions=Iy(t.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),f=u?u.match(d):null;if(f)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]||"text/plain"},body:f[2]?Km(f[3]):(p=f[3],Ym(p.replace(/%([0-9a-f][0-9a-f])/gi,((t,e)=>String.fromCharCode(parseInt(e,16))))))};let e=t.body;return n&&(e=n(t.body,t)),Promise.resolve(e)}catch(t){lA.throwError("processing response error",Lp.errors.SERVER_ERROR,{body:dA(f[1],f[2]),error:t,requestBody:null,requestMethod:"GET",url:u})}var p;e&&(c.method="POST",c.body=e,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(e.length)}));const y={};Object.keys(s).forEach((t=>{const e=s[t];y[e.key]=e.value})),c.headers=y;const m=function(){let t=null;return{promise:new Promise((function(e,n){h&&(t=setTimeout((()=>{null!=t&&(t=null,n(lA.makeError("timeout",Lp.errors.TIMEOUT,{requestBody:dA(c.body,y["content-type"]),requestMethod:c.method,timeout:h,url:u})))}),h))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),g=function(){return cA(this,void 0,void 0,(function*(){for(let t=0;t=300)&&(m.cancel(),lA.throwError("bad response",Lp.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:dA(s,e.headers?e.headers["content-type"]:null),requestBody:dA(c.body,y["content-type"]),requestMethod:c.method,url:u})),n)try{const t=yield n(s,e);return m.cancel(),t}catch(n){if(n.throttleRetry&&t{let r=null;if(null!=t)try{r=JSON.parse(Wm(t))}catch(e){lA.throwError("invalid JSON",Lp.errors.SERVER_ERROR,{body:t,error:e})}return n&&(r=n(r,e)),r}))}function pA(t,e){return e||(e={}),null==(e=Iy(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(n,r){let i=null,o=!1;const a=()=>!o&&(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout((()=>{a()&&r(new Error("timeout"))}),e.timeout));const s=e.retryLimit;let u=0;!function i(){return t().then((function(t){if(void 0!==t)a()&&n(t);else if(e.oncePoll)e.oncePoll.once("poll",i);else if(e.onceBlock)e.onceBlock.once("block",i);else if(!o){if(u++,u>s)return void(a()&&r(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,u)));te.ceiling&&(t=e.ceiling),setTimeout(i,t)}return null}),(function(t){a()&&r(t)}))}()}))}for(var yA="qpzry9x8gf2tvdw0s3jn54khce6mua7l",mA={},gA=0;gA>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function bA(t){for(var e=1,n=0;n126)return"Invalid prefix ("+t+")";e=wA(e)^r>>5}for(e=wA(e),n=0;ne)return"Exceeds length limit";var n=t.toLowerCase(),r=t.toUpperCase();if(t!==n&&t!==r)return"Mixed-case string "+t;var i=(t=n).lastIndexOf("1");if(-1===i)return"No separator character for "+t;if(0===i)return"Missing prefix for "+t;var o=t.slice(0,i),a=t.slice(i+1);if(a.length<6)return"Data too short";var s=bA(o);if("string"==typeof s)return s;for(var u=[],c=0;c=a.length||u.push(h)}return 1!==s?"Invalid checksum for "+t:{prefix:o,words:u}}function AA(t,e,n,r){for(var i=0,o=0,a=(1<=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<=e)return"Excess padding";if(i<n)throw new TypeError("Exceeds length limit");var r=bA(t=t.toLowerCase());if("string"==typeof r)throw new Error(r);for(var i=t+"1",o=0;o>5!=0)throw new Error("Non 5-bit word");r=wA(r)^a,i+=yA.charAt(a)}for(o=0;o<6;++o)r=wA(r);for(r^=1,o=0;o<6;++o){i+=yA.charAt(r>>5*(5-o)&31)}return i},toWordsUnsafe:function(t){var e=AA(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=AA(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=AA(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=AA(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}};const IA="providers/5.7.2",EA=new Lp(IA);class xA{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),n=this.bigNumber.bind(this),r=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),s=this.number.bind(this),u=this.type.bind(this);return t.transaction={hash:o,type:u,accessList:xA.allowNull(this.accessList.bind(this),null),blockHash:xA.allowNull(o,null),blockNumber:xA.allowNull(s,null),transactionIndex:xA.allowNull(s,null),confirmations:xA.allowNull(s,null),from:e,gasPrice:xA.allowNull(n),maxPriorityFeePerGas:xA.allowNull(n),maxFeePerGas:xA.allowNull(n),gasLimit:n,to:xA.allowNull(e,null),value:n,nonce:s,data:i,r:xA.allowNull(this.uint256),s:xA.allowNull(this.uint256),v:xA.allowNull(s),creates:xA.allowNull(e,null),raw:xA.allowNull(i)},t.transactionRequest={from:xA.allowNull(e),nonce:xA.allowNull(s),gasLimit:xA.allowNull(n),gasPrice:xA.allowNull(n),maxPriorityFeePerGas:xA.allowNull(n),maxFeePerGas:xA.allowNull(n),to:xA.allowNull(e),value:xA.allowNull(n),data:xA.allowNull((t=>this.data(t,!0))),type:xA.allowNull(s),accessList:xA.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:s,blockNumber:s,transactionHash:o,address:e,topics:xA.arrayOf(o),data:i,logIndex:s,blockHash:o},t.receipt={to:xA.allowNull(this.address,null),from:xA.allowNull(this.address,null),contractAddress:xA.allowNull(e,null),transactionIndex:s,root:xA.allowNull(a),gasUsed:n,logsBloom:xA.allowNull(i),blockHash:o,transactionHash:o,logs:xA.arrayOf(this.receiptLog.bind(this)),blockNumber:s,confirmations:xA.allowNull(s,null),cumulativeGasUsed:n,effectiveGasPrice:xA.allowNull(n),status:xA.allowNull(s),type:u},t.block={hash:xA.allowNull(o),parentHash:o,number:s,timestamp:s,nonce:xA.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:xA.allowNull(e),extraData:i,transactions:xA.allowNull(xA.arrayOf(o)),baseFeePerGas:xA.allowNull(n)},t.blockWithTransactions=Iy(t.block),t.blockWithTransactions.transactions=xA.allowNull(xA.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:xA.allowNull(r,void 0),toBlock:xA.allowNull(r,void 0),blockHash:xA.allowNull(o,void 0),address:xA.allowNull(e,void 0),topics:xA.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:xA.allowNull(s),blockHash:xA.allowNull(o),transactionIndex:s,removed:xA.allowNull(this.boolean.bind(this)),address:e,data:xA.allowFalsish(i,"0x"),topics:xA.arrayOf(o),transactionHash:o,logIndex:s},t}accessList(t){return jM(t||[])}number(t){return"0x"===t?0:ey.from(t).toNumber()}type(t){return"0x"===t||null==t?0:ey.from(t).toNumber()}bigNumber(t){return ey.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),Up(t))?t.toLowerCase():EA.throwArgumentError("invalid hash","value",t)}data(t,e){const n=this.hex(t,e);if(n.length%2!=0)throw new Error("invalid data; odd-length - "+t);return n}address(t){return vm(t)}callAddress(t){if(!Up(t,32))return null;const e=vm(Fp(t,12));return"0x0000000000000000000000000000000000000000"===e?null:e}contractAddress(t){return wm(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";switch(t){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return t}if("number"==typeof t||Up(t))return Hp(t);throw new Error("invalid blockTag")}hash(t,e){const n=this.hex(t,e);return 32!==Wp(n)?EA.throwArgumentError("invalid hash","value",t):n}difficulty(t){if(null==t)return null;const e=ey.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!Up(t))throw new Error("invalid uint256");return Gp(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);const n=null!=t._difficulty?t._difficulty:t.difficulty,r=xA.check(e,t);return r._difficulty=null==n?null:ey.from(n),r}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return xA.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&ey.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const e=xA.check(this.formats.transaction,t);if(null!=t.chainId){let n=t.chainId;Up(n)&&(n=ey.from(n).toNumber()),e.chainId=n}else{let n=t.networkId;null==n&&null==e.v&&(n=t.chainId),Up(n)&&(n=ey.from(n).toNumber()),"number"!=typeof n&&null!=e.v&&(n=(e.v-35)/2,n<0&&(n=0),n=parseInt(n)),"number"!=typeof n&&(n=0),e.chainId=n}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return PM(t)}receiptLog(t){return xA.check(this.formats.receiptLog,t)}receipt(t){const e=xA.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=ey.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&EA.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):EA.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&EA.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map((t=>this.topics(t))):null!=t?this.hash(t,!0):null}filter(t){return xA.check(this.formats.filter,t)}filterLog(t){return xA.check(this.formats.filterLog,t)}static check(t,e){const n={};for(const r in t)try{const i=t[r](e[r]);void 0!==i&&(n[r]=i)}catch(t){throw t.checkKey=r,t.checkValue=e[r],t}return n}static allowNull(t,e){return function(n){return null==n?e:t(n)}}static allowFalsish(t,e){return function(n){return n?t(n):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const n=[];return e.forEach((function(e){n.push(t(e))})),n}}}var kA=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const TA=new Lp(IA);function LA(t){return null==t?"null":(32!==Wp(t)&&TA.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function SA(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map((t=>{if(Array.isArray(t)){const e={};t.forEach((t=>{e[LA(t)]=!0}));const n=Object.keys(e);return n.sort(),n.join("|")}return LA(t)})).join("&")}function jA(t){if("string"==typeof t){if(32===Wp(t=t.toLowerCase()))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+SA(t);if(Jg.isForkEvent(t))throw TA.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+SA(t.topics||[])}throw new Error("invalid event - "+t)}function CA(){return(new Date).getTime()}function DA(t){return new Promise((e=>{setTimeout(e,t)}))}const OA=["block","network","pending","poll"];class zA{constructor(t,e,n){My(this,"tag",t),My(this,"listener",e),My(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],n=""===(r=t[2])?[]:r.split(/&/g).map((t=>{if(""===t)return[];const e=t.split("|").map((t=>"null"===t?null:t));return 1===e.length?e[0]:e}));var r;const i={};return n.length>0&&(i.topics=n),e&&"*"!==e&&(i.address=e),i}pollable(){return this.tag.indexOf(":")>=0||OA.indexOf(this.tag)>=0}}const PA={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function _A(t){return Gp(ey.from(t).toHexString(),32)}function BA(t){return KM.encode(_p([t,Fp($M($M(t)),0,4)]))}const RA=new RegExp("^(ipfs)://(.*)$","i"),UA=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),RA,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function QA(t,e){try{return Wm(YA(t,e))}catch(t){}return null}function YA(t,e){if("0x"===t)return null;const n=ey.from(Fp(t,e,e+32)).toNumber(),r=ey.from(Fp(t,n,n+32)).toNumber();return Fp(t,n+32,n+32+r)}function WA(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):TA.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function FA(t){const e=Pp(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function VA(t){if(t.length%32==0)return t;const e=new Uint8Array(32*Math.ceil(t.length/32));return e.set(t),e}function HA(t){const e=[];let n=0;for(let r=0;rey.from(t).eq(1))).catch((t=>{if(t.code===Lp.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t}))),this._supportsEip2544}_fetch(t,e){return kA(this,void 0,void 0,(function*(){const n={to:this.address,ccipReadEnabled:!0,data:Vp([t,Ng(this.name),e||"0x"])};let r=!1;var i;(yield this.supportsWildcard())&&(r=!0,n.data=Vp(["0x9061b923",HA([(i=this.name,Yp(_p(Ag(i).map((t=>{if(t.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const e=new Uint8Array(t.length+1);return e.set(t,1),e[0]=e.length-1,e}))))+"00"),n.data])]));try{let t=yield this.provider.call(n);return Pp(t).length%32==4&&TA.throwError("resolver threw error",Lp.errors.CALL_EXCEPTION,{transaction:n,data:t}),r&&(t=YA(t,0)),t}catch(t){if(t.code===Lp.errors.CALL_EXCEPTION)return null;throw t}}))}_fetchBytes(t,e){return kA(this,void 0,void 0,(function*(){const n=yield this._fetch(t,e);return null!=n?YA(n,0):null}))}_getAddress(t,e){const n=PA[String(t)];if(null==n&&TA.throwError(`unsupported coin type: ${t}`,Lp.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===n.ilk)return this.provider.formatter.address(e);const r=Pp(e);if(null!=n.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return BA(_p([[n.p2pkh],"0x"+t[2]]))}}if(null!=n.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return BA(_p([[n.p2sh],"0x"+t[2]]))}}if(null!=n.prefix){const t=r[1];let e=r[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&r.length===2+t&&t>=1&&t<=75){const t=NA.toWords(r.slice(2));return t.unshift(e),NA.encode(n.prefix,t)}}return null}getAddress(t){return kA(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t)try{const t=yield this._fetch("0x3b3b57de");return"0x"===t||"0x0000000000000000000000000000000000000000000000000000000000000000"===t?null:this.provider.formatter.callAddress(t)}catch(t){if(t.code===Lp.errors.CALL_EXCEPTION)return null;throw t}const e=yield this._fetchBytes("0xf1cb7e06",_A(t));if(null==e||"0x"===e)return null;const n=this._getAddress(t,e);return null==n&&TA.throwError("invalid or unsupported coin data",Lp.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),n}))}getAvatar(){return kA(this,void 0,void 0,(function*(){const t=[{type:"name",content:this.name}];try{const e=yield this.getText("avatar");if(null==e)return null;for(let n=0;nt[e]))}return TA.throwError("invalid or unsupported content hash data",Lp.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})}))}getText(t){return kA(this,void 0,void 0,(function*(){let e=Ym(t);e=_p([_A(64),_A(e.length),e]),e.length%32!=0&&(e=_p([e,Gp("0x",32-t.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",Yp(e));return null==n||"0x"===n?null:Wm(n)}))}}let qA=null,ZA=1;class JA extends Xg{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),My(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch((t=>{})),this._ready().catch((t=>{}));else{const e=Ay(new.target,"getNetwork")(t);e?(My(this,"_network",e),this.emit("network",e,null)):TA.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return kA(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||TA.throwError("no network detected",Lp.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:My(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return pA((()=>this._ready().then((t=>t),(t=>{if(t.code!==Lp.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))))}static getFormatter(){return null==qA&&(qA=new xA),qA}static getNetwork(t){return function(t){if(null==t)return null;if("number"==typeof t){for(const e in aA){const n=aA[e];if(n.chainId===t)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){const e=aA[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}const e=aA[t.name];if(!e)return"number"!=typeof t.chainId&&tA.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&tA.throwArgumentError("network chainId mismatch","network",t);let n=t._defaultProvider||null;var r;return null==n&&e._defaultProvider&&(n=(r=e._defaultProvider)&&"function"==typeof r.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:n}}(null==t?"homestead":t)}ccipReadFetch(t,e,n){return kA(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===n.length)return null;const r=t.to.toLowerCase(),i=e.toLowerCase(),o=[];for(let t=0;t=0?null:JSON.stringify({data:i,sender:r}),u=yield fA({url:a,errorPassThrough:!0},s,((t,e)=>(t.status=e.statusCode,t)));if(u.data)return u.data;const c=u.message||"unknown error";if(u.status>=400&&u.status<500)return TA.throwError(`response not found during CCIP fetch: ${c}`,Lp.errors.SERVER_ERROR,{url:e,errorMessage:c});o.push(c)}return TA.throwError(`error encountered during CCIP fetch: ${o.map((t=>JSON.stringify(t))).join(", ")}`,Lp.errors.SERVER_ERROR,{urls:n,errorMessages:o})}))}_getInternalBlockNumber(t){return kA(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const n=yield e;if(CA()-n.respTime<=t)return n.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=CA(),n=Ny({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((t=>null),(t=>t))}).then((({blockNumber:t,networkError:r})=>{if(r)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),r;const i=CA();return(t=ey.from(t).toNumber()){this._internalBlockNumber===n&&(this._internalBlockNumber=null)})),(yield n).blockNumber}))}poll(){return kA(this,void 0,void 0,(function*(){const t=ZA++,e=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(n),this.emit("poll",t,n),n!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)TA.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",TA.makeError("network block skew detected",Lp.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let t=this._emitted.block+1;t<=n;t++)this.emit("block",t);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&n-e>12&&delete this._emitted[t]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((t=>{switch(t.type){case"tx":{const n=t.hash;let r=this.getTransactionReceipt(n).then((t=>t&&null!=t.blockNumber?(this._emitted["t:"+n]=t.blockNumber,this.emit(n,t),null):null)).catch((t=>{this.emit("error",t)}));e.push(r);break}case"filter":if(!t._inflight){t._inflight=!0,-2===t._lastBlockNumber&&(t._lastBlockNumber=n-1);const r=t.filter;r.fromBlock=t._lastBlockNumber+1,r.toBlock=n;const i=r.toBlock-this._maxFilterBlockRange;i>r.fromBlock&&(r.fromBlock=i),r.fromBlock<0&&(r.fromBlock=0);const o=this.getLogs(r).then((e=>{t._inflight=!1,0!==e.length&&e.forEach((e=>{e.blockNumber>t._lastBlockNumber&&(t._lastBlockNumber=e.blockNumber),this._emitted["b:"+e.blockHash]=e.blockNumber,this._emitted["t:"+e.transactionHash]=e.blockNumber,this.emit(r,e)}))})).catch((e=>{this.emit("error",e),t._inflight=!1}));e.push(o)}}})),this._lastBlockNumber=n,Promise.all(e).then((()=>{this.emit("didPoll",t)})).catch((t=>{this.emit("error",t)}))}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return kA(this,void 0,void 0,(function*(){return TA.throwError("provider does not support network detection",Lp.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return kA(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",e,t),yield DA(0),this._network;const n=TA.makeError("underlying network changed",Lp.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",n),n}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((t=>{this._setFastBlockNumber(t)}),(t=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const t=CA();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&tthis._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,n){return kA(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,n||0,null)}))}_waitForTransaction(t,e,n,r){return kA(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(t);return(i?i.confirmations:0)>=e?i:new Promise(((i,o)=>{const a=[];let s=!1;const u=function(){return!!s||(s=!0,a.forEach((t=>{t()})),!1)},c=t=>{t.confirmations{this.removeListener(t,c)})),r){let n=r.startBlock,i=null;const c=a=>kA(this,void 0,void 0,(function*(){s||(yield DA(1e3),this.getTransactionCount(r.from).then((l=>kA(this,void 0,void 0,(function*(){if(!s){if(l<=r.nonce)n=a;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==i&&(i=n-3,i{s||this.once("block",c)})))}));if(s)return;this.once("block",c),a.push((()=>{this.removeListener("block",c)}))}if("number"==typeof n&&n>0){const t=setTimeout((()=>{u()||o(TA.makeError("timeout exceeded",Lp.errors.TIMEOUT,{timeout:n}))}),n);t.unref&&t.unref(),a.push((()=>{clearTimeout(t)}))}}))}))}getBlockNumber(){return kA(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return ey.from(t)}catch(e){return TA.throwError("bad result from backend",Lp.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Ny({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getBalance",n);try{return ey.from(r)}catch(t){return TA.throwError("bad result from backend",Lp.errors.SERVER_ERROR,{method:"getBalance",params:n,result:r,error:t})}}))}getTransactionCount(t,e){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Ny({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getTransactionCount",n);try{return ey.from(r).toNumber()}catch(t){return TA.throwError("bad result from backend",Lp.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:r,error:t})}}))}getCode(t,e){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Ny({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getCode",n);try{return Yp(r)}catch(t){return TA.throwError("bad result from backend",Lp.errors.SERVER_ERROR,{method:"getCode",params:n,result:r,error:t})}}))}getStorageAt(t,e,n){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Ny({address:this._getAddress(t),blockTag:this._getBlockTag(n),position:Promise.resolve(e).then((t=>Hp(t)))}),i=yield this.perform("getStorageAt",r);try{return Yp(i)}catch(t){return TA.throwError("bad result from backend",Lp.errors.SERVER_ERROR,{method:"getStorageAt",params:r,result:i,error:t})}}))}_wrapTransaction(t,e,n){if(null!=e&&32!==Wp(e))throw new Error("invalid response - sendTransaction");const r=t;return null!=e&&t.hash!==e&&TA.throwError("Transaction hash mismatch from Provider.sendTransaction.",Lp.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),r.wait=(e,r)=>kA(this,void 0,void 0,(function*(){let i;null==e&&(e=1),null==r&&(r=0),0!==e&&null!=n&&(i={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:n});const o=yield this._waitForTransaction(t.hash,e,r,i);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&TA.throwError("transaction failed",Lp.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),r}sendTransaction(t){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then((t=>Yp(t))),n=this.formatter.transaction(t);null==n.confirmations&&(n.confirmations=0);const r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(n,t,r)}catch(t){throw t.transaction=n,t.transactionHash=n.hash,t}}))}_getTransactionRequest(t){return kA(this,void 0,void 0,(function*(){const e=yield t,n={};return["from","to"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?this._getAddress(t):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?ey.from(t):null)))})),["type"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>null!=t?t:null)))})),e.accessList&&(n.accessList=this.formatter.accessList(e.accessList)),["data"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?Yp(t):null)))})),this.formatter.transactionRequest(yield Ny(n))}))}_getFilter(t){return kA(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach((n=>{null!=t[n]&&(e[n]=t[n])})),["fromBlock","toBlock"].forEach((n=>{null!=t[n]&&(e[n]=this._getBlockTag(t[n]))})),this.formatter.filter(yield Ny(e))}))}_call(t,e,n){return kA(this,void 0,void 0,(function*(){n>=10&&TA.throwError("CCIP read exceeded maximum redirections",Lp.errors.SERVER_ERROR,{redirects:n,transaction:t});const r=t.to,i=yield this.perform("call",{transaction:t,blockTag:e});if(n>=0&&"latest"===e&&null!=r&&"0x556f1830"===i.substring(0,10)&&Wp(i)%32==4)try{const o=Fp(i,4),a=Fp(o,0,32);ey.from(a).eq(r)||TA.throwError("CCIP Read sender did not match",Lp.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i});const s=[],u=ey.from(Fp(o,32,64)).toNumber(),c=ey.from(Fp(o,u,u+32)).toNumber(),l=Fp(o,u+32);for(let e=0;ekA(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",r);if(null==t)return null!=r.blockHash&&null==this._emitted["b:"+r.blockHash]||null!=r.blockTag&&n>this._emitted.block?null:void 0;if(e){let e=null;for(let n=0;nthis._wrapTransaction(t))),n}return this.formatter.block(t)}))),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return kA(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return pA((()=>kA(this,void 0,void 0,(function*(){const n=yield this.perform("getTransaction",e);if(null==n)return null==this._emitted["t:"+t]?null:void 0;const r=this.formatter.transactionResponse(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;t<=0&&(t=1),r.confirmations=t}return this._wrapTransaction(r)}))),{oncePoll:this})}))}getTransactionReceipt(t){return kA(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return pA((()=>kA(this,void 0,void 0,(function*(){const n=yield this.perform("getTransactionReceipt",e);if(null==n)return null==this._emitted["t:"+t]?null:void 0;if(null==n.blockHash)return;const r=this.formatter.receipt(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;t<=0&&(t=1),r.confirmations=t}return r}))),{oncePoll:this})}))}getLogs(t){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Ny({filter:this._getFilter(t)}),n=yield this.perform("getLogs",e);return n.forEach((t=>{null==t.removed&&(t.removed=!1)})),xA.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)}))}getEtherPrice(){return kA(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return kA(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&TA.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return kA(this,void 0,void 0,(function*(){let e=t;for(;;){if(""===e||"."===e)return null;if("eth"!==t&&"eth"===e)return null;const n=yield this._getResolver(e,"getResolver");if(null!=n){const r=new GA(this,n,t);return e===t||(yield r.supportsWildcard())?r:null}e=e.split(".").slice(1).join(".")}}))}_getResolver(t,e){return kA(this,void 0,void 0,(function*(){null==e&&(e="ENS");const n=yield this.getNetwork();n.ensAddress||TA.throwError("network does not support ENS",Lp.errors.UNSUPPORTED_OPERATION,{operation:e,network:n.name});try{const e=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+Ng(t).substring(2)});return this.formatter.callAddress(e)}catch(t){}return null}))}resolveName(t){return kA(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if(Up(t))throw e}"string"!=typeof t&&TA.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return kA(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(e,"lookupAddress");if(null==n)return null;const r=QA(yield this.call({to:n,data:"0x691f3431"+Ng(e).substring(2)}),0);return(yield this.resolveName(r))!=t?null:r}))}getAvatar(t){return kA(this,void 0,void 0,(function*(){let e=null;if(Up(t)){const n=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(n,"getAvatar");if(!r)return null;e=new GA(this,r,n);try{const t=yield e.getAvatar();if(t)return t.url}catch(t){if(t.code!==Lp.errors.CALL_EXCEPTION)throw t}try{const t=QA(yield this.call({to:r,data:"0x691f3431"+Ng(n).substring(2)}),0);e=yield this.getResolver(t)}catch(t){if(t.code!==Lp.errors.CALL_EXCEPTION)throw t;return null}}else if(e=yield this.getResolver(t),!e)return null;const n=yield e.getAvatar();return null==n?null:n.url}))}perform(t,e){return TA.throwError(t+" not implemented",Lp.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_stopEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_addEventListener(t,e,n){const r=new zA(jA(t),e,n);return this._events.push(r),this._startEvent(r),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let n=!1,r=[],i=jA(t);return this._events=this._events.filter((t=>t.tag!==i||(setTimeout((()=>{t.listener.apply(this,e)}),0),n=!0,!t.once||(r.push(t),!1)))),r.forEach((t=>{this._stopEvent(t)})),n}listenerCount(t){if(!t)return this._events.length;let e=jA(t);return this._events.filter((t=>t.tag===e)).length}listeners(t){if(null==t)return this._events.map((t=>t.listener));let e=jA(t);return this._events.filter((t=>t.tag===e)).map((t=>t.listener))}off(t,e){if(null==e)return this.removeAllListeners(t);const n=[];let r=!1,i=jA(t);return this._events=this._events.filter((t=>t.tag!==i||t.listener!=e||(!!r||(r=!0,n.push(t),!1)))),n.forEach((t=>{this._stopEvent(t)})),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const n=jA(t);this._events=this._events.filter((t=>t.tag!==n||(e.push(t),!1)))}return e.forEach((t=>{this._stopEvent(t)})),this}}var XA=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const KA=new Lp(IA),$A=["call","estimateGas"];function tN(t,e){if(null==t)return null;if("string"==typeof t.message&&t.message.match("reverted")){const n=Up(t.data)?t.data:null;if(!e||n)return{message:t.message,data:n}}if("object"==typeof t){for(const n in t){const r=tN(t[n],e);if(r)return r}return null}if("string"==typeof t)try{return tN(JSON.parse(t),e)}catch(t){}return null}function eN(t,e,n){const r=n.transaction||n.signedTransaction;if("call"===t){const t=tN(e,!0);if(t)return t.data;KA.throwError("missing revert data in call exception; Transaction reverted without a reason string",Lp.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if("estimateGas"===t){let n=tN(e.body,!1);null==n&&(n=tN(e,!1)),n&&KA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Lp.errors.UNPREDICTABLE_GAS_LIMIT,{reason:n.message,method:t,transaction:r,error:e})}let i=e.message;throw e.code===Lp.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?i=e.error.message:"string"==typeof e.body?i=e.body:"string"==typeof e.responseText&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&KA.throwError("insufficient funds for intrinsic transaction cost",Lp.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),i.match(/nonce (is )?too low/i)&&KA.throwError("nonce has already been used",Lp.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&KA.throwError("replacement fee too low",Lp.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),i.match(/only replay-protected/i)&&KA.throwError("legacy pre-eip-155 transactions not supported",Lp.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:r}),$A.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&KA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Lp.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}function nN(t){return new Promise((function(e){setTimeout(e,t)}))}function rN(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function iN(t){return t?t.toLowerCase():t}const oN={};class aN extends nv{constructor(t,e,n){if(super(),t!==oN)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");My(this,"provider",e),null==n&&(n=0),"string"==typeof n?(My(this,"_address",this.provider.formatter.address(n)),My(this,"_index",null)):"number"==typeof n?(My(this,"_index",n),My(this,"_address",null)):KA.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(t){return KA.throwError("cannot alter JSON-RPC Signer connection",Lp.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new sN(oN,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((t=>(t.length<=this._index&&KA.throwError("unknown account #"+this._index,Lp.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index]))))}sendUncheckedTransaction(t){t=Iy(t);const e=this.getAddress().then((t=>(t&&(t=t.toLowerCase()),t)));if(null==t.gasLimit){const n=Iy(t);n.from=e,t.gasLimit=this.provider.estimateGas(n)}return null!=t.to&&(t.to=Promise.resolve(t.to).then((t=>XA(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.provider.resolveName(t);return null==e&&KA.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))))),Ny({tx:Ny(t),sender:e}).then((({tx:e,sender:n})=>{null!=e.from?e.from.toLowerCase()!==n&&KA.throwArgumentError("from address mismatch","transaction",t):e.from=n;const r=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[r]).then((t=>t),(t=>("string"==typeof t.message&&t.message.match(/user denied/i)&&KA.throwError("user rejected transaction",Lp.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:e}),eN("sendTransaction",t,r))))}))}signTransaction(t){return KA.throwError("signing transactions is unsupported",Lp.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return XA(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(t);try{return yield pA((()=>XA(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(n);if(null!==t)return this.provider._wrapTransaction(t,n,e)}))),{oncePoll:this.provider})}catch(t){throw t.transactionHash=n,t}}))}signMessage(t){return XA(this,void 0,void 0,(function*(){const e="string"==typeof t?Ym(t):t,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[Yp(e),n.toLowerCase()])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&KA.throwError("user rejected signing",Lp.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:t}),e}}))}_legacySignMessage(t){return XA(this,void 0,void 0,(function*(){const e="string"==typeof t?Ym(t):t,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),Yp(e)])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&KA.throwError("user rejected signing",Lp.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:t}),e}}))}_signTypedData(t,e,n){return XA(this,void 0,void 0,(function*(){const r=yield Rg.resolveNames(t,e,n,(t=>this.provider.resolveName(t))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(Rg.getPayload(r.domain,e,r.value))])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&KA.throwError("user rejected signing",Lp.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:r.domain,types:e,value:r.value}}),t}}))}unlock(t){return XA(this,void 0,void 0,(function*(){const e=this.provider,n=yield this.getAddress();return e.send("personal_unlockAccount",[n.toLowerCase(),t,null])}))}}class sN extends aN{sendTransaction(t){return this.sendUncheckedTransaction(t).then((t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)})))}}const uN={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class cN extends JA{constructor(t,e){let n=e;null==n&&(n=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then((e=>{t(e)}),(t=>{e(t)}))}),0)}))),super(n),t||(t=Ay(this.constructor,"defaultUrl")()),My(this,"connection","string"==typeof t?Object.freeze({url:t}):Object.freeze(Iy(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return XA(this,void 0,void 0,(function*(){yield nN(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=Ay(this.constructor,"getNetwork");try{return e(ey.from(t).toNumber())}catch(e){return KA.throwError("could not detect network",Lp.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return KA.throwError("could not detect network",Lp.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new aN(oN,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((t=>t.map((t=>this.formatter.address(t)))))}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Ty(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(r&&this._cache[t])return this._cache[t];const i=fA(this.connection,JSON.stringify(n),rN).then((t=>(this.emit("debug",{action:"response",request:n,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:n,provider:this}),t}));return r&&(this._cache[t]=i,setTimeout((()=>{this._cache[t]=null}),0)),i}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[iN(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[iN(e.address),e.blockTag]];case"getCode":return["eth_getCode",[iN(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[iN(e.address),Gp(e.position,32),e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[Ay(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[Ay(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=iN(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return XA(this,void 0,void 0,(function*(){if("call"===t||"estimateGas"===t){const t=e.transaction;if(t&&null!=t.type&&ey.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const n=yield this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&((e=Iy(e)).transaction=Iy(t),delete e.transaction.type)}}const n=this.prepareRequest(t,e);null==n&&KA.throwError(t+" not implemented",Lp.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(n[0],n[1])}catch(n){return eN(t,n,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(n){return function r(){t.send("eth_getFilterChanges",[n]).then((function(n){if(t._pendingFilter!=e)return null;let r=Promise.resolve();return n.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",r=r.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),r.then((function(){return nN(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){r()}),0),null;t.send("eth_uninstallFilter",[n])})).catch((t=>{}))}(),n})).catch((t=>{}))}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const n=Iy(uN);if(e)for(const t in e)e[t]&&(n[t]=!0);var r,i;i=n,(r=t)&&"object"==typeof r||by.throwArgumentError("invalid object","object",r),Object.keys(r).forEach((t=>{i[t]||by.throwArgumentError("invalid object key - "+t,"transaction:"+t,r)}));const o={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(e){if(null==t[e])return;const n=Hp(ey.from(t[e]));"gasLimit"===e&&(e="gas"),o[e]=n})),["from","to","data"].forEach((function(e){null!=t[e]&&(o[e]=Yp(t[e]))})),t.accessList&&(o.accessList=jM(t.accessList)),o}}const lN=new Lp(IA);let hN=1;function dN(t,e){const n="Web3LegacyFetcher";return function(t,r){const i={method:t,params:r,id:hN++,jsonrpc:"2.0"};return new Promise(((t,r)=>{this.emit("debug",{action:"request",fetcher:n,request:Ty(i),provider:this}),e(i,((e,o)=>{if(e)return this.emit("debug",{action:"response",fetcher:n,error:e,request:i,provider:this}),r(e);if(this.emit("debug",{action:"response",fetcher:n,request:i,response:o,provider:this}),o.error){const t=new Error(o.error.message);return t.code=o.error.code,t.data=o.error.data,r(t)}t(o.result)}))}))}}class fN extends cN{constructor(t,e){null==t&&lN.throwArgumentError("missing provider","provider",t);let n=null,r=null,i=null;"function"==typeof t?(n="unknown:",r=t):(n=t.host||t.path||"",!n&&t.isMetaMask&&(n="metamask"),i=t,t.request?(""===n&&(n="eip-1193:"),r=function(t){return function(e,n){null==n&&(n=[]);const r={method:e,params:n};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:Ty(r),provider:this}),t.request(r).then((t=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:t,provider:this}),t}))}}(t)):t.sendAsync?r=dN(0,t.sendAsync.bind(t)):t.send?r=dN(0,t.send.bind(t)):lN.throwArgumentError("unsupported provider","provider",t),n||(n="unknown:")),super(n,e),My(this,"jsonRpcFetchFunc",r),My(this,"provider",i)}send(t,e){return this.jsonRpcFetchFunc(t,e)}}const pN=new RegExp("^bytes([0-9]+)$"),yN=new RegExp("^(u?int)([0-9]*)$"),mN=new RegExp("^(.*)\\[([0-9]*)\\]$"),gN=new Lp("solidity/5.7.0");function vN(t,e,n){switch(t){case"address":return n?Rp(e,32):Pp(e);case"string":return Ym(e);case"bytes":return Pp(e);case"bool":return e=e?"0x01":"0x00",n?Rp(e,32):Pp(e)}let r=t.match(yN);if(r){let i=parseInt(r[2]||"256");return(r[2]&&String(i)!==r[2]||i%8!=0||0===i||i>256)&&gN.throwArgumentError("invalid number type","type",t),n&&(i=256),Rp(e=ey.from(e).toTwos(i),i/8)}if(r=t.match(pN),r){const i=parseInt(r[1]);return(String(i)!==r[1]||0===i||i>32)&&gN.throwArgumentError("invalid bytes type","type",t),Pp(e).byteLength!==i&&gN.throwArgumentError(`invalid value for ${t}`,"value",e),n?Pp((e+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):e}if(r=t.match(mN),r&&Array.isArray(e)){const n=r[1];parseInt(r[2]||String(e.length))!=e.length&&gN.throwArgumentError(`invalid array length for ${t}`,"value",e);const i=[];return e.forEach((function(t){i.push(vN(n,t,!0))})),_p(i)}return gN.throwArgumentError("invalid type","type",t)}function wN(t,e){t.length!=e.length&&gN.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const n=[];return t.forEach((function(t,r){n.push(vN(t,e[r]))})),Yp(_p(n))}const bN=new Lp("units/5.7.0"),MN=["wei","kwei","mwei","gwei","szabo","finney","ether"];function AN(t,e){if("string"==typeof e){const t=MN.indexOf(e);-1!==t&&(e=3*t)}return fy(t,null!=e?e:18)}function NN(t,e){if("string"!=typeof t&&bN.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=MN.indexOf(e);-1!==t&&(e=3*t)}return py(t,null!=e?e:18)}let IN,EN=()=>IN||(IN="object"==typeof r?r:window,IN);const xN=()=>(void 0===EN()._Web3ClientConfiguration&&(EN()._Web3ClientConfiguration={}),EN()._Web3ClientConfiguration);function kN(t){let e,n=t[0],r=1;for(;rn.call(e,...t))),e=void 0)}return n}class TN extends cN{constructor(t,e,n,r){super(t),this._network=e,this._endpoint=t,this._endpoints=n,this._failover=r,this._pendingBatch=[]}detectNetwork(){return Promise.resolve(tp.findByName(this._network).id)}requestChunk(t,e){try{const n=t.map((t=>t.request));return fA(e,JSON.stringify(n)).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(kN([r,"optionalAccess",t=>t.error])){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else kN([r,"optionalAccess",t=>t.result])?t.resolve(r.result):t.reject()}))})).catch((e=>{if(e&&"SERVER_ERROR"==e.code){const e=this._endpoints.indexOf(this._endpoint)+1;this._failover(),this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this.requestChunk(t,this._endpoint)}else t.forEach((t=>{t.reject(e)}))}))}catch(e){t.forEach((t=>{t.reject()}))}}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const e=[];for(let n=0;n(t.map((t=>t.request)),this.requestChunk(t,this._endpoint))))}),xN().batchInterval||10)),i}}const LN=()=>(null==EN()._Web3ClientProviders&&(EN()._Web3ClientProviders={}),EN()._Web3ClientProviders),SN=(t,e)=>{void 0===LN()[t]&&(LN()[t]=[]);const n=LN()[t].indexOf(e);n>-1&&LN()[t].splice(n,1),LN()[t].unshift(e)},jN=async(t,e,n=!0)=>{let r;LN()[t]=e.map(((r,i)=>new TN(r,t,e,(()=>{1===LN()[t].length?jN(t,e,n):LN()[t].splice(i,1)}))));let i=EN();if(null==i.fetch||void 0!==k&&k.env&&"test"==k.env.NODE_ENV||void 0!==i.cy||!1===n)r=LN()[t][0];else{let n=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},referrer:"",referrerPolicy:"no-referrer",body:JSON.stringify({method:"net_version",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const i=Math.min(...n),o=n.indexOf(i);r=LN()[t][o]}SN(t,r)};var CN={getProvider:async t=>{let e=LN();if(e&&e[t])return e[t][0];let n=EN();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[t]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[t]=new Promise((async e=>{await jN(t,tp[t].endpoints),e(EN()._Web3ClientProviders[t][0])}))),await n._Web3ClientGetProviderPromise[t]},getProviders:async t=>{let e=LN();if(e&&e[t])return e[t];let n=EN();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[t]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[t]=new Promise((async e=>{await jN(t,tp[t].endpoints),e(EN()._Web3ClientProviders[t])}))),await n._Web3ClientGetProvidersPromise[t]},setProviderEndpoints:jN,setProvider:SN};class DN extends eh{constructor(t,e,n,r){super(t),this._provider=new eh(t),this._network=e,this._endpoint=t,this._endpoints=n,this._failover=r,this._pendingBatch=[],this._rpcRequest=this._rpcRequestReplacement.bind(this)}requestChunk(t){const e=t.map((t=>t.request)),n=e=>{if(e&&["Failed to fetch","limit reached","504","503","502","500","429","426","422","413","409","408","406","405","404","403","402","401","400"].some((t=>e.toString().match(t)))){const e=this._endpoints.indexOf(this._endpoint)+1;this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this._provider=new eh(this._endpoint),this.requestChunk(t)}else t.forEach((t=>{t.reject(e)}))};try{return this._provider._rpcBatchRequest(e).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(function(t){let e,n=t[0],r=1;for(;rn.call(e,...t))),e=void 0)}return n}([r,"optionalAccess",t=>t.error])){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else r?t.resolve(r):t.reject()}))})).catch(n)}catch(t){return n(t)}}_rpcRequestReplacement(t,e){const n={methodName:t,args:e};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const e=[];for(let n=0;n(t.map((t=>t.request)),this.requestChunk(t))))}),xN().batchInterval||10)),i}}const ON=()=>(null==EN()._Web3ClientProviders&&(EN()._Web3ClientProviders={}),EN()._Web3ClientProviders),zN=(t,e)=>{void 0===ON()[t]&&(ON()[t]=[]);const n=ON()[t].indexOf(e);n>-1&&ON()[t].splice(n,1),ON()[t].unshift(e)},PN=async(t,e,n=!0)=>{let r;ON()[t]=e.map(((r,i)=>new DN(r,t,e,(()=>{1===ON()[t].length?PN(t,e,n):ON()[t].splice(i,1)}))));let i=EN();if(null==i.fetch||void 0!==k&&k.env&&"test"==k.env.NODE_ENV||void 0!==i.cy||!1===n)r=ON()[t][0];else{let n=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},referrer:"",referrerPolicy:"no-referrer",body:JSON.stringify({method:"getIdentity",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const i=Math.min(...n),o=n.indexOf(i);r=ON()[t][o]}zN(t,r)};var _N={getProvider:async t=>{let e=ON();if(e&&e[t])return e[t][0];let n=EN();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[t]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[t]=new Promise((async e=>{await PN(t,tp[t].endpoints),e(EN()._Web3ClientProviders[t][0])}))),await n._Web3ClientGetProviderPromise[t]},getProviders:async t=>{let e=ON();if(e&&e[t])return e[t];let n=EN();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[t]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[t]=new Promise((async e=>{await PN(t,tp[t].endpoints),e(EN()._Web3ClientProviders[t])}))),await n._Web3ClientGetProvidersPromise[t]},setProviderEndpoints:PN,setProvider:zN};let BN=["ethereum","bsc","polygon","solana","fantom","arbitrum","avalanche","gnosis","optimism","base"];BN.evm=["ethereum","bsc","polygon","fantom","arbitrum","avalanche","gnosis","optimism","base"],BN.solana=["solana"];let RN=()=>(null==EN()._Web3ClientCacheStore&&(EN()._Web3ClientCacheStore={}),EN()._Web3ClientCacheStore),UN=()=>(null==EN()._Web3ClientPromiseStore&&(EN()._Web3ClientPromiseStore={}),EN()._Web3ClientPromiseStore),QN=function({key:t}){UN()[t]=void 0},YN=function({call:t,key:e,expires:n=0}){return new Promise(((r,i)=>{let o,a=function({key:t}){return UN()[t]}({key:e=JSON.stringify(e)});if(a)return a.then(r).catch(i);(function({key:t,promise:e}){return UN()[t]=e,e})({key:e,promise:new Promise(((a,s)=>0===n?t().then((t=>{r(t),a(t)})).catch((t=>{i(t),s(t)})):(o=function({key:t,expires:e}){let n=RN()[t];if(function(t){let e,n=t[0],r=1;for(;rn.call(e,...t))),e=void 0)}return n}([n,"optionalAccess",t=>t.expiresAt])>Date.now())return n.value}({key:e,expires:n}),o?(r(o),a(o),o):void t().then((t=>{t&&function({key:t,value:e,expires:n}){RN()[t]={expiresAt:Date.now()+n,value:e}}({key:e,value:t,expires:n}),r(t),a(t)})).catch((t=>{i(t),s(t)})))))}).then((()=>{QN({key:e})})).catch((()=>{QN({key:e})}))}))};const WN=async t=>{if(BN.evm.includes(t))return await CN.getProvider(t);if(BN.solana.includes(t))return await _N.getProvider(t);throw"Unknown blockchain: "+t},FN=t=>`(${t.map((t=>"tuple"===t.type?FN(t.components):t.type)).join(",")})`;var VN=({provider:t,from:e,to:n,value:r,method:i,api:o,params:a})=>{if(void 0===o)return t.estimateGas({from:e,to:n,value:r});{let s=new JM(n,o,t),u=s.interface.fragments.find((t=>t.name==i)),c=(({contract:t,method:e,params:n})=>{let r=t.interface.fragments.find((t=>t.name==e));return n instanceof Array?n:n instanceof Object?r.inputs.map((t=>n[t.name])):void 0})({contract:s,method:i,params:a});void 0===s[i]&&(i=`${i}(${u.inputs.map((t=>"tuple"===t.type?FN(t.components):t.type)).join(",")})`);let l=s.estimateGas[i];return c?l(...c,{from:e,value:r}):l({from:e,value:r})}};let HN=async function({blockchain:t,from:e,to:n,value:r,method:i,api:o,params:a,cache:s}){if(!BN.includes(t))throw"Unknown blockchain: "+t;void 0===r&&(r="0");const u=await WN(t);return await YN({expires:s||0,key:[t,e,n,r,i,a],call:async()=>VN({provider:u,from:e,to:n,value:r,method:i,api:o,params:a})})};const GN=({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=new JM(t,e,i),s=(({contract:t,method:e,params:n})=>t.interface.fragments.find((t=>t.name==e)).inputs.map(((t,e)=>Array.isArray(n)?n[e]:n[t.name])))({contract:a,method:n,params:r}),u=a.interface.fragments.find((t=>t.name===n));return void 0===a[n]&&(n=`${n}(${u.inputs.map((t=>t.type)).join(",")})`),u&&"nonpayable"===u.stateMutability?a.callStatic[n](...s,{blockTag:o}):a[n](...s,{blockTag:o})},qN=({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a})=>n?GN({address:e,api:n,method:r,params:i,provider:a,block:o}):"latestBlockNumber"===r?a.getBlockNumber():"balance"===r?(({address:t,provider:e})=>e.getBalance(t))({address:e,provider:a}):"transactionCount"===r?(({address:t,provider:e})=>e.getTransactionCount(t))({address:e,provider:a}):void 0;const ZN=async({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a,providers:s})=>{try{if(null==r||"getAccountInfo"===r)return null==n&&(n=df),await(async({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=await i.getAccountInfo(new eu(t));if(a&&a.data)return e.decode(a.data)})({address:e,api:n,method:r,params:i,provider:a,block:o});if("getProgramAccounts"===r)return await a.getProgramAccounts(new eu(e),i).then((t=>n?t.map((t=>(t.data=n.decode(t.account.data),t))):t));if("getTokenAccountBalance"===r)return await a.getTokenAccountBalance(new eu(e));if("latestBlockNumber"===r)return await a.getSlot(i||void 0);if("balance"===r)return await(({address:t,provider:e})=>e.getBalance(new eu(t)))({address:e,provider:a})}catch(u){if(s&&u&&["Failed to fetch","limit reached","504","503","502","500","429","426","422","413","409","408","406","405","404","403","402","401","400"].some((t=>u.toString().match(t)))){let u=s[s.indexOf(a)+1]||s[0];return ZN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:u,providers:s})}throw u}};const JN=async function(t,e){const{blockchain:n,address:r,method:i}=(t=>{if("object"==typeof t)return t;let e=t.match(/(?\w+):\/\/(?[\w\d]+)(\/(?[\w\d]+)*)?/);return null==e.groups.part2?e.groups.part1.match(/\d/)?{blockchain:e.groups.blockchain,address:e.groups.part1}:{blockchain:e.groups.blockchain,method:e.groups.part1}:{blockchain:e.groups.blockchain,address:e.groups.part1,method:e.groups.part2}})(t),{api:o,params:a,cache:s,block:u,timeout:c,strategy:l,cacheKey:h}=("object"==typeof t?t:e)||{};return await YN({expires:s||0,key:h||[n,r,i,a,u],call:async()=>{if(BN.evm.includes(n))return await(async({blockchain:t,address:e,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{if(s=s||xN().strategy||"failover",a=a||xN().timeout||void 0,"fastest"===s){const s=await CN.getProviders(t);let u=[];const c=s.map((a=>new Promise((s=>{u.push(qN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a}).then(s))})))),l=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a||1e4)));return u=Promise.all(u.map((t=>new Promise((e=>{t.catch(e)}))))).then((()=>{})),Promise.race([...c,l,u])}{const s=await CN.getProvider(t),u=qN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:s});return a?(a=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a))),Promise.race([u,a])):u}})({blockchain:n,address:r,api:o,method:i,params:a,block:u,strategy:l,timeout:c});if(BN.solana.includes(n))return await(async({blockchain:t,address:e,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{s=s||xN().strategy||"failover",a=a||xN().timeout||void 0;const u=await _N.getProviders(t);if("fastest"===s){let s=[];const c=u.map((a=>new Promise((u=>{s.push(ZN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a}).then(u))})))),l=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a||1e4)));return s=Promise.all(s.map((t=>new Promise((e=>{t.catch(e)}))))).then((()=>{})),Promise.race([...c,l,s])}{const s=await _N.getProvider(t),c=ZN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:s,providers:u});return a?(a=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a))),Promise.race([c,a])):c}})({blockchain:n,address:r,api:o,method:i,params:a,block:u,strategy:l,timeout:c});throw"Unknown blockchain: "+n}})};var XN=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.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 i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));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=128)}([function(t,e,n){(function(t,r,i){n.d(e,"a",(function(){return Xi})),n.d(e,"b",(function(){return da})),n.d(e,"c",(function(){return to})),n.d(e,"d",(function(){return Lo})),n.d(e,"e",(function(){return ot})),n.d(e,"f",(function(){return $})),n.d(e,"g",(function(){return Hi})),n.d(e,"h",(function(){return tt})),n.d(e,"i",(function(){return ao})),n.d(e,"j",(function(){return uo})),n.d(e,"k",(function(){return ro})),n.d(e,"l",(function(){return co})),n.d(e,"m",(function(){return so})),n.d(e,"n",(function(){return st})),n.d(e,"o",(function(){return rt})),n.d(e,"p",(function(){return Qi})),n.d(e,"q",(function(){return Z})),n.d(e,"r",(function(){return nt})),n.d(e,"s",(function(){return ko})),n.d(e,"t",(function(){return eo})),n.d(e,"u",(function(){return no})),n.d(e,"v",(function(){return G})),n.d(e,"w",(function(){return H})),n.d(e,"x",(function(){return Zi})),n.d(e,"y",(function(){return lt})),n.d(e,"z",(function(){return Ri})),n.d(e,"A",(function(){return Co})),n.d(e,"B",(function(){return qi})),n.d(e,"C",(function(){return Bi})),n.d(e,"D",(function(){return Ji})),n.d(e,"E",(function(){return yo})),n.d(e,"F",(function(){return po})),n.d(e,"G",(function(){return Do})),n.d(e,"H",(function(){return ct})),n.d(e,"I",(function(){return io})),n.d(e,"J",(function(){return oo})),n.d(e,"K",(function(){return F})),n.d(e,"L",(function(){return aa})),n.d(e,"M",(function(){return at})),n.d(e,"N",(function(){return Y})),n.d(e,"O",(function(){return ca})),n.d(e,"P",(function(){return Yo})),n.d(e,"Q",(function(){return W})),n.d(e,"R",(function(){return Ro})),n.d(e,"S",(function(){return Wo})),n.d(e,"T",(function(){return fo})),n.d(e,"U",(function(){return Po})),n.d(e,"V",(function(){return Oo})),n.d(e,"W",(function(){return Fo})),n.d(e,"X",(function(){return $o})),n.d(e,"Y",(function(){return na})),n.d(e,"Z",(function(){return Xo})),n.d(e,"ab",(function(){return qo})),n.d(e,"bb",(function(){return ra})),n.d(e,"cb",(function(){return oa})),n.d(e,"db",(function(){return ia})),n.d(e,"eb",(function(){return zo})),n.d(e,"fb",(function(){return Ko})),n.d(e,"gb",(function(){return Zo})),n.d(e,"hb",(function(){return Jo})),n.d(e,"ib",(function(){return ta})),n.d(e,"jb",(function(){return ua})),n.d(e,"kb",(function(){return Go})),n.d(e,"lb",(function(){return ea})),n.d(e,"mb",(function(){return _o})),n.d(e,"nb",(function(){return Qo})),n.d(e,"ob",(function(){return X})),n.d(e,"pb",(function(){return Gi})),n.d(e,"qb",(function(){return K})),n.d(e,"rb",(function(){return S})),n.d(e,"sb",(function(){return it})),n.d(e,"tb",(function(){return Eo})),n.d(e,"ub",(function(){return la})),n.d(e,"vb",(function(){return lo})),n.d(e,"wb",(function(){return ho})),n.d(e,"xb",(function(){return Ui}));var o=n(71),a=n(1),s=n(21),u=n(68),c=n(32),l=n(43),h=n(69),d=n(24),f=n(38),p=n(44),y=n(5),m=n(70);function g(t,e,n){return(e=M(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){for(var n=0;n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function N(t){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function I(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=k(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function E(t){return function(t){if(Array.isArray(t))return T(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||k(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(t,e)||k(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(t,e){if(t){if("string"==typeof t)return T(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T(t,e):void 0}}function T(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:a.FIVE_MINUTES,i=arguments.length>1?arguments[1]:void 0,o=Object(a.toMiliseconds)(r||a.FIVE_MINUTES);return{resolve:function(e){n&&t&&(clearTimeout(n),t(e))},reject:function(t){n&&e&&(clearTimeout(n),e(t))},done:function(){return new Promise((function(r,a){n=setTimeout((function(){a(new Error(i))}),o),t=r,e=a}))}}}function tt(t,e,n){var r=this;return new Promise((function(i,o){return L(r,null,A().mark((function r(){var a,s;return A().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=setTimeout((function(){return o(new Error(n))}),e),r.prev=1,r.next=4,t;case 4:s=r.sent,i(s),r.next=11;break;case 8:r.prev=8,r.t0=r.catch(1),o(r.t0);case 11:clearTimeout(a);case 12:case"end":return r.stop()}}),r,null,[[1,8]])})))}))}function et(t,e){if("string"==typeof e&&e.startsWith("".concat(t,":")))return e;if("topic"===t.toLowerCase()){if("string"!=typeof e)throw new Error('Value must be "string" for expirer target type: topic');return"topic:".concat(e)}if("id"===t.toLowerCase()){if("number"!=typeof e)throw new Error('Value must be "number" for expirer target type: id');return"id:".concat(e)}throw new Error("Unknown expirer target type: ".concat(t))}function nt(t){return et("topic",t)}function rt(t){return et("id",t)}function it(t){var e=x(t.split(":"),2),n=e[0],r=e[1],i={id:void 0,topic:void 0};if("topic"===n&&"string"==typeof r)i.topic=r;else{if("id"!==n||!Number.isInteger(Number(r)))throw new Error("Invalid target, expected id:number or topic:string, got ".concat(n,":").concat(r));i.id=Number(r)}return i}function ot(t,e){return Object(a.fromMiliseconds)((e||Date.now())+Object(a.toMiliseconds)(t))}function at(t){return Date.now()>=Object(a.toMiliseconds)(t)}function st(t,e){return"".concat(t).concat(e?":".concat(e):"")}function ut(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return E(new Set([].concat(E(t),E(e))))}function ct(t){return L(this,arguments,(function(t){var e=t.id,n=t.topic,i=t.wcDeepLink;return A().mark((function t(){var o,a,s,u;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,i){t.next=3;break}return t.abrupt("return");case 3:if(o="string"==typeof i?JSON.parse(i):i,"string"==typeof(a=null==o?void 0:o.href)){t.next=7;break}return t.abrupt("return");case 7:if(a.endsWith("/")&&(a=a.slice(0,-1)),s="".concat(a,"/wc?requestId=").concat(e,"&sessionTopic=").concat(n),(u=V())!==U){t.next=13;break}s.startsWith("https://")||s.startsWith("http://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"),t.next=17;break;case 13:if(t.t0=u===B&&N(null==r?void 0:r.Linking)<"u",!t.t0){t.next=17;break}return t.next=17,r.Linking.openURL(s);case 17:t.next=22;break;case 19:t.prev=19,t.t1=t.catch(0),console.error(t.t1);case 22:case"end":return t.stop()}}),t,null,[[0,19]])}))()}))}function lt(t,e){return L(this,null,A().mark((function n(){return A().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,t.getItem(e);case 3:if(n.t0=n.sent,n.t0){n.next=6;break}n.t0=F()?localStorage.getItem(e):void 0;case 6:return n.abrupt("return",n.t0);case 9:n.prev=9,n.t1=n.catch(0),console.error(n.t1);case 12:case"end":return n.stop()}}),n,null,[[0,9]])})))}var ht=("undefined"==typeof globalThis?"undefined":N(globalThis))<"u"?globalThis:("undefined"==typeof window?"undefined":N(window))<"u"?window:(void 0===r?"undefined":N(r))<"u"?r:("undefined"==typeof self?"undefined":N(self))<"u"?self:{},dt={exports:{}};!function(e){!function(){var n="input is invalid type",r="object"==("undefined"==typeof window?"undefined":N(window)),i=r?window:{};i.JS_SHA3_NO_WINDOW&&(r=!1);var o=!r&&"object"==("undefined"==typeof self?"undefined":N(self));!i.JS_SHA3_NO_NODE_JS&&"object"==(void 0===t?"undefined":N(t))&&t.versions&&t.versions.node?i=ht:o&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&e.exports,s=!i.JS_SHA3_NO_ARRAY_BUFFER&&("undefined"==typeof ArrayBuffer?"undefined":N(ArrayBuffer))<"u",u="0123456789abcdef".split(""),c=[4,1024,262144,67108864],l=[0,8,16,24],h=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],f=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],y={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),s&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return"object"==N(t)&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var m=function(t,e,n){return function(r){return new C(t,e,t).update(r)[n]()}},g=function(t,e,n){return function(r,i){return new C(t,e,i).update(r)[n]()}},v=function(t,e,n){return function(e,r,i,o){return I["cshake"+t].update(e,r,i,o)[n]()}},w=function(t,e,n){return function(e,r,i,o){return I["kmac"+t].update(e,r,i,o)[n]()}},b=function(t,e,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function D(t,e,n){C.call(this,t,e,n)}C.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=N(t);if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(s&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||s&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var i,o,a=this.blocks,u=this.byteCount,c=t.length,h=this.blockCount,d=0,f=this.s;d>2]|=t[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(a[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=u){for(this.start=i-u,this.block=a[h],i=0;i>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},C.prototype.encodeString=function(t){var e,r=N(t);if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(s&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||s&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}var i=0,o=t.length;if(e)i=o;else for(var a=0;a=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(t),i},C.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e>4&15]+u[15&t]+u[t>>12&15]+u[t>>8&15]+u[t>>20&15]+u[t>>16&15]+u[t>>28&15]+u[t>>24&15];a%e==0&&(O(n),o=0)}return i&&(t=n[o],s+=u[t>>4&15]+u[15&t],i>1&&(s+=u[t>>12&15]+u[t>>8&15]),i>2&&(s+=u[t>>20&15]+u[t>>16&15])),s},C.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&O(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},D.prototype=new C,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var O=function(t){var e,n,r,i,o,a,s,u,c,l,d,f,p,y,m,g,v,w,b,M,A,N,I,E,x,k,T,L,S,j,C,D,O,z,P,_,B,R,U,Q,Y,W,F,V,H,G,q,Z,J,X,K,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(l<<1|d>>>31),n=s^(d<<1|l>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=l^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,y=t[0],m=t[1],G=t[11]<<4|t[10]>>>28,q=t[10]<<4|t[11]>>>28,L=t[20]<<3|t[21]>>>29,S=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,W=t[40]<<18|t[41]>>>14,F=t[41]<<18|t[40]>>>14,z=t[2]<<1|t[3]>>>31,P=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,Z=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,j=t[33]<<13|t[32]>>>19,C=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,_=t[14]<<6|t[15]>>>26,B=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,K=t[35]<<15|t[34]>>>17,D=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,E=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,R=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,H=t[9]<<27|t[8]>>>5,k=t[18]<<20|t[19]>>>12,T=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,Q=t[38]<<8|t[39]>>>24,Y=t[39]<<8|t[38]>>>24,N=t[48]<<14|t[49]>>>18,I=t[49]<<14|t[48]>>>18,t[0]=y^~g&w,t[1]=m^~v&b,t[10]=E^~k&L,t[11]=x^~T&S,t[20]=z^~_&R,t[21]=P^~B&U,t[30]=V^~G&Z,t[31]=H^~q&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=g^~w&M,t[3]=v^~b&A,t[12]=k^~L&j,t[13]=T^~S&C,t[22]=_^~R&Q,t[23]=B^~U&Y,t[32]=G^~Z&X,t[33]=q^~J&K,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=w^~M&N,t[5]=b^~A&I,t[14]=L^~j&D,t[15]=S^~C&O,t[24]=R^~Q&W,t[25]=U^~Y&F,t[34]=Z^~X&$,t[35]=J^~K&tt,t[44]=ot^~st&ct,t[45]=at^~ut<,t[6]=M^~N&y,t[7]=A^~I&m,t[16]=j^~D&E,t[17]=C^~O&x,t[26]=Q^~W&z,t[27]=Y^~F&P,t[36]=X^~$&V,t[37]=K^~tt&H,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=N^~y&g,t[9]=I^~m&v,t[18]=D^~E&k,t[19]=O^~x&T,t[28]=W^~z&_,t[29]=F^~P&B,t[38]=$^~V&G,t[39]=tt^~H&q,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=h[r],t[1]^=h[r+1]};if(a)e.exports=I;else for(x=0;xvt[n])&&console.log.apply(console,e)}},{key:"debug",value:function(){for(var e=arguments.length,n=new Array(e),r=0;r>4],n+=At[15&e[o]];i.push(t+"=Uint8Array(0x"+n+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push("code=".concat(n)),i.push("version=".concat(this.version));var o=e,a="";switch(n){case pt.NUMERIC_FAULT:a="NUMERIC_FAULT";var s=e;switch(s){case"overflow":case"underflow":case"division-by-zero":a+="-"+s;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result"}break;case pt.CALL_EXCEPTION:case pt.INSUFFICIENT_FUNDS:case pt.MISSING_NEW:case pt.NONCE_EXPIRED:case pt.REPLACEMENT_UNDERPRICED:case pt.TRANSACTION_REPLACED:case pt.UNPREDICTABLE_GAS_LIMIT:a=n}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),i.length&&(e+=" ("+i.join(", ")+")");var u=new Error(e);return u.reason=o,u.code=n,Object.keys(r).forEach((function(t){u[t]=r[t]})),u}},{key:"throwError",value:function(t,e,n){throw this.makeError(t,e,n)}},{key:"throwArgumentError",value:function(e,n,r){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:n,value:r})}},{key:"assert",value:function(t,e,n,r){t||this.throwError(e,n,r)}},{key:"assertArgument",value:function(t,e,n,r){t||this.throwArgumentError(e,n,r)}},{key:"checkNormalize",value:function(e){Mt&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Mt})}},{key:"checkSafeUint53",value:function(e,n){"number"==typeof e&&(null==n&&(n="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(n,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(n,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}},{key:"checkArgumentCount",value:function(e,n,r){r=r?": "+r:"",en&&this.throwError("too many arguments"+r,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:n})}},{key:"checkNew",value:function(e,n){(e===Object||null==e)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:n.name})}},{key:"checkAbstract",value:function(e,n){e===n?this.throwError("cannot instantiate abstract class "+JSON.stringify(n.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||null==e)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:n.name})}}],[{key:"globalLogger",value:function(){return bt||(bt=new t("logger/5.7.0")),bt}},{key:"setCensorship",value:function(e,n){if(!e&&n&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),mt){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}gt=!!e,mt=!!n}},{key:"setLogLevel",value:function(e){var n=vt[e.toLowerCase()];null!=n?wt=n:t.globalLogger().warn("invalid log level - "+e)}},{key:"from",value:function(e){return new t(e)}}])}();Nt.errors=pt,Nt.levels=ft;var It=new Nt("bytes/5.7.0");function Et(t){return!!t.toHexString}function xt(t){return t.slice||(t.slice=function(){var e=Array.prototype.slice.call(arguments);return xt(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function kt(t){return"number"==typeof t&&t==t&&t%1==0}function Tt(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t||!kt(t.length)||t.length<0)return!1;for(var e=0;e=256)return!1}return!0}function Lt(t,e){if(e||(e={}),"number"==typeof t){It.checkSafeUint53(t,"invalid arrayify value");for(var n=[];t;)n.unshift(255&t),t=parseInt(String(t/256));return 0===n.length&&n.push(0),xt(new Uint8Array(n))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Et(t)&&(t=t.toHexString()),St(t)){var r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":It.throwArgumentError("hex data is odd-length","value",t));for(var i=[],o=0;o>4]+jt[15&o]}return r}return It.throwArgumentError("invalid hexlify value","value",t)}function Dt(t,e,n){return"string"!=typeof t?t=Ct(t):(!St(t)||t.length%2)&&It.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=n?"0x"+t.substring(e,2+2*n):"0x"+t.substring(e)}function Ot(t,e){for("string"!=typeof t?t=Ct(t):St(t)||It.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&It.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function zt(t){var e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(function(t){return St(t)&&!(t.length%2)||Tt(t)}(t)){var n=Lt(t);64===n.length?(e.v=27+(n[32]>>7),n[32]&=127,e.r=Ct(n.slice(0,32)),e.s=Ct(n.slice(32,64))):65===n.length?(e.r=Ct(n.slice(0,32)),e.s=Ct(n.slice(32,64)),e.v=n[64]):It.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:It.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(n[32]|=128),e._vs=Ct(n.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){var r=function(t,e){(t=Lt(t)).length>e&&It.throwArgumentError("value out of range","value",arguments[0]);var n=new Uint8Array(e);return n.set(t,e-t.length),xt(n)}(Lt(e._vs),32);e._vs=Ct(r);var i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&It.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;var o=Ct(r);null==e.s?e.s=o:e.s!==o&&It.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?It.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{var a=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==a&&It.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&St(e.r)?e.r=Ot(e.r,32):It.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&St(e.s)?e.s=Ot(e.s,32):It.throwArgumentError("signature missing or invalid s","signature",t);var s=Lt(e.s);s[0]>=128&&It.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(s[0]|=128);var u=Ct(s);e._vs&&(St(e._vs)||It.throwArgumentError("signature invalid _vs","signature",t),e._vs=Ot(e._vs,32)),null==e._vs?e._vs=u:e._vs!==u&&It.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Pt(t){return"0x"+yt.keccak_256(Lt(t))}var _t={exports:{}},Bt=function(t){var e=t.default;if("function"==typeof e){var n=function(){return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}(Object.freeze({__proto__:null,default:{}}));!function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"==N(t)?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o=("undefined"==typeof window?"undefined":N(window))<"u"&&N(window.Buffer)<"u"?window.Buffer:Bt.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==N(t))return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},("undefined"==typeof Symbol?"undefined":N(Symbol))<"u"&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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 p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}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 r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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 8191&e||(n+=13,e>>>=13),127&e||(n+=7,e>>>=7),15&e||(n+=4,e>>>=4),3&e||(n+=2,e>>>=2),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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&a}for(;i>26,this.words[i+r]=67108863&a;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):this.negative&t.negative?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;!(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;!(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e,r=this,o=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var a=new i(1),s=new i(0),u=o.clone();r.cmpn(1)>0&&o.cmpn(1)>0;){for(var c=0,l=1;!(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;!(o.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(o.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);r.cmp(o)>=0?(r.isub(o),a.isub(s)):(o.isub(r),s.isub(a))}return(e=0===r.cmpn(1)?a:s).cmpn(0)<0&&e.iadd(t),e},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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 E(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function x(t){E.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new I}return v[t]=e,e},E.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.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)},E.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},E.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)},E.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new x(t)},r(x,E),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,ht)}(_t);var Rt=_t.exports,Ut="bignumber/5.7.0",Qt=Rt.BN,Yt=new Nt(Ut),Wt={},Ft=9007199254740991,Vt=!1,Ht=function(){function t(e,n){v(this,t),e!==Wt&&Yt.throwError("cannot call constructor directly; use BigNumber.from",Nt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=n,this._isBigNumber=!0,Object.freeze(this)}return b(t,[{key:"fromTwos",value:function(t){return qt(Zt(this).fromTwos(t))}},{key:"toTwos",value:function(t){return qt(Zt(this).toTwos(t))}},{key:"abs",value:function(){return"-"===this._hex[0]?t.from(this._hex.substring(1)):this}},{key:"add",value:function(t){return qt(Zt(this).add(Zt(t)))}},{key:"sub",value:function(t){return qt(Zt(this).sub(Zt(t)))}},{key:"div",value:function(e){return t.from(e).isZero()&&Jt("division-by-zero","div"),qt(Zt(this).div(Zt(e)))}},{key:"mul",value:function(t){return qt(Zt(this).mul(Zt(t)))}},{key:"mod",value:function(t){var e=Zt(t);return e.isNeg()&&Jt("division-by-zero","mod"),qt(Zt(this).umod(e))}},{key:"pow",value:function(t){var e=Zt(t);return e.isNeg()&&Jt("negative-power","pow"),qt(Zt(this).pow(e))}},{key:"and",value:function(t){var e=Zt(t);return(this.isNegative()||e.isNeg())&&Jt("unbound-bitwise-result","and"),qt(Zt(this).and(e))}},{key:"or",value:function(t){var e=Zt(t);return(this.isNegative()||e.isNeg())&&Jt("unbound-bitwise-result","or"),qt(Zt(this).or(e))}},{key:"xor",value:function(t){var e=Zt(t);return(this.isNegative()||e.isNeg())&&Jt("unbound-bitwise-result","xor"),qt(Zt(this).xor(e))}},{key:"mask",value:function(t){return(this.isNegative()||t<0)&&Jt("negative-width","mask"),qt(Zt(this).maskn(t))}},{key:"shl",value:function(t){return(this.isNegative()||t<0)&&Jt("negative-width","shl"),qt(Zt(this).shln(t))}},{key:"shr",value:function(t){return(this.isNegative()||t<0)&&Jt("negative-width","shr"),qt(Zt(this).shrn(t))}},{key:"eq",value:function(t){return Zt(this).eq(Zt(t))}},{key:"lt",value:function(t){return Zt(this).lt(Zt(t))}},{key:"lte",value:function(t){return Zt(this).lte(Zt(t))}},{key:"gt",value:function(t){return Zt(this).gt(Zt(t))}},{key:"gte",value:function(t){return Zt(this).gte(Zt(t))}},{key:"isNegative",value:function(){return"-"===this._hex[0]}},{key:"isZero",value:function(){return Zt(this).isZero()}},{key:"toNumber",value:function(){try{return Zt(this).toNumber()}catch(t){Jt("overflow","toNumber",this.toString())}return null}},{key:"toBigInt",value:function(){try{return BigInt(this.toString())}catch(t){}return Yt.throwError("this platform does not support BigInt",Nt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}},{key:"toString",value:function(){return arguments.length>0&&(10===arguments[0]?Vt||(Vt=!0,Yt.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Yt.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Nt.errors.UNEXPECTED_ARGUMENT,{}):Yt.throwError("BigNumber.toString does not accept parameters",Nt.errors.UNEXPECTED_ARGUMENT,{})),Zt(this).toString(10)}},{key:"toHexString",value:function(){return this._hex}},{key:"toJSON",value:function(t){return{type:"BigNumber",hex:this.toHexString()}}}],[{key:"from",value:function(e){if(e instanceof t)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new t(Wt,Gt(e)):e.match(/^-?[0-9]+$/)?new t(Wt,Gt(new Qt(e))):Yt.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Jt("underflow","BigNumber.from",e),(e>=Ft||e<=-Ft)&&Jt("overflow","BigNumber.from",e),t.from(String(e));var n=e;if("bigint"==typeof n)return t.from(n.toString());if(Tt(n))return t.from(Ct(n));if(n)if(n.toHexString){var r=n.toHexString();if("string"==typeof r)return t.from(r)}else{var i=n._hex;if(null==i&&"BigNumber"===n.type&&(i=n.hex),"string"==typeof i&&(St(i)||"-"===i[0]&&St(i.substring(1))))return t.from(i)}return Yt.throwArgumentError("invalid BigNumber value","value",e)}},{key:"isBigNumber",value:function(t){return!(!t||!t._isBigNumber)}}])}();function Gt(t){if("string"!=typeof t)return Gt(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Yt.throwArgumentError("invalid hex","value",t),"0x00"===(t=Gt(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function qt(t){return Ht.from(Gt(t))}function Zt(t){var e=Ht.from(t).toHexString();return"-"===e[0]?new Qt("-"+e.substring(3),16):new Qt(e.substring(2),16)}function Jt(t,e,n){var r={fault:t,operation:e};return null!=n&&(r.value=n),Yt.throwError(t,Nt.errors.NUMERIC_FAULT,r)}var Xt=new Nt(Ut),Kt={},$t=Ht.from(0),te=Ht.from(-1);function ee(t,e,n,r){var i={fault:e,operation:n};return void 0!==r&&(i.value=r),Xt.throwError(t,Nt.errors.NUMERIC_FAULT,i)}for(var ne="0";ne.length<256;)ne+=ne;function re(t){if("number"!=typeof t)try{t=Ht.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+ne.substring(0,t):Xt.throwArgumentError("invalid decimal size","decimals",t)}function ie(t,e){null==e&&(e=0);var n=re(e),r=(t=Ht.from(t)).lt($t);r&&(t=t.mul(te));for(var i=t.mod(n).toString();i.length2&&Xt.throwArgumentError("too many decimal points","value",t);var o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>n.length-1&&ee("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length80&&Xt.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new t(Kt,n,r,i)}}])}(),ce=function(){function t(e,n,r,i){v(this,t),e!==Kt&&Xt.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Nt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=n,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}return b(t,[{key:"_checkFormat",value:function(t){this.format.name!==t.format.name&&Xt.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}},{key:"addUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.add(r),this.format.decimals,this.format)}},{key:"subUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.sub(r),this.format.decimals,this.format)}},{key:"mulUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}},{key:"divUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}},{key:"floor",value:function(){var e=this.toString().split(".");1===e.length&&e.push("0");var n=t.from(e[0],this.format),r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(n=n.subUnsafe(le.toFormat(n.format))),n}},{key:"ceiling",value:function(){var e=this.toString().split(".");1===e.length&&e.push("0");var n=t.from(e[0],this.format),r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(n=n.addUnsafe(le.toFormat(n.format))),n}},{key:"round",value:function(e){null==e&&(e=0);var n=this.toString().split(".");if(1===n.length&&n.push("0"),(e<0||e>80||e%1)&&Xt.throwArgumentError("invalid decimal count","decimals",e),n[1].length<=e)return this;var r=t.from("1"+ne.substring(0,e),this.format),i=he.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(i).floor().divUnsafe(r)}},{key:"isZero",value:function(){return"0.0"===this._value||"0"===this._value}},{key:"isNegative",value:function(){return"-"===this._value[0]}},{key:"toString",value:function(){return this._value}},{key:"toHexString",value:function(t){return null==t?this._hex:(t%8&&Xt.throwArgumentError("invalid byte width","width",t),Ot(Ht.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8))}},{key:"toUnsafeFloat",value:function(){return parseFloat(this.toString())}},{key:"toFormat",value:function(e){return t.fromString(this._value,e)}}],[{key:"fromValue",value:function(e,n,r){return null==r&&null!=n&&!function(t){return null!=t&&(Ht.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||St(t)||"bigint"==typeof t||Tt(t))}(n)&&(r=n,n=null),null==n&&(n=0),null==r&&(r="fixed"),t.fromString(ie(e,n),ue.from(r))}},{key:"fromString",value:function(e,n){null==n&&(n="fixed");var r=ue.from(n),i=oe(e,r.decimals);!r.signed&&i.lt($t)&&ee("unsigned value cannot be negative","overflow","value",e);var o=null;o=r.signed?i.toTwos(r.width).toHexString():Ot(o=i.toHexString(),r.width/8);var a=ie(i,r.decimals);return new t(Kt,o,a,r)}},{key:"fromBytes",value:function(e,n){null==n&&(n="fixed");var r=ue.from(n);if(Lt(e).length>r.width/8)throw new Error("overflow");var i=Ht.from(e);r.signed&&(i=i.fromTwos(r.width));var o=i.toTwos((r.signed?0:1)+r.width).toHexString(),a=ie(i,r.decimals);return new t(Kt,o,a,r)}},{key:"from",value:function(e,n){if("string"==typeof e)return t.fromString(e,n);if(Tt(e))return t.fromBytes(e,n);try{return t.fromValue(e,0,n)}catch(t){if(t.code!==Nt.errors.INVALID_ARGUMENT)throw t}return Xt.throwArgumentError("invalid FixedNumber value","value",e)}},{key:"isFixedNumber",value:function(t){return!(!t||!t._isFixedNumber)}}])}(),le=ce.from(1),he=ce.from("0.5"),de=new Nt("strings/5.7.0");function fe(t,e,n,r,i){if(t===se.BAD_PREFIX||t===se.UNEXPECTED_CONTINUE){for(var o=0,a=e+1;a>6==2;a++)o++;return o}return t===se.OVERRUN?n.length-e-1:0}function pe(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ae.current;e!=ae.current&&(de.checkNormalize(),t=t.normalize(e));for(var n=[],r=0;r>6|192),n.push(63&i|128);else if(55296==(64512&i)){r++;var o=t.charCodeAt(r);if(r>=t.length||56320!=(64512&o))throw new Error("invalid utf-8 string");var a=65536+((1023&i)<<10)+(1023&o);n.push(a>>18|240),n.push(a>>12&63|128),n.push(a>>6&63|128),n.push(63&a|128)}else n.push(i>>12|224),n.push(i>>6&63|128),n.push(63&i|128)}return Lt(n)}function ye(t,e){e||(e=function(t){return[parseInt(t,16)]});var n=0,r={};return t.split(",").forEach((function(t){var i=t.split(":");n+=parseInt(i[0],16),r[n]=e(i[1])})),r}function me(t){var e=0;return t.split(",").map((function(t){var n=t.split("-");return 1===n.length?n[1]="0":""===n[1]&&(n[1]="1"),{l:e+parseInt(n[0],16),h:e=parseInt(n[1],16)}}))}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(ae||(ae={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(se||(se={})),Object.freeze({error:function(t,e,n,r,i){return de.throwArgumentError("invalid codepoint at offset ".concat(e,"; ").concat(t),"bytes",n)},ignore:fe,replace:function(t,e,n,r,i){return t===se.OVERLONG?(r.push(i),0):(r.push(65533),fe(t,e,n))}}),me("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((function(t){return parseInt(t,16)})),ye("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),ye("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),ye("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");for(var e=[],n=0;n0&&Array.isArray(e)?t(e,i-1):n.push(e)}))}(t,e),n}function we(t){return 1&t?~t>>1:t>>1}function be(t,e){for(var n=Array(t),r=0,i=-1;r>--c&1}for(var d=Math.pow(2,31),f=d>>>1,p=f>>1,y=d-1,m=0,g=0;g<31;g++)m=m<<1|h();for(var v=[],w=0,b=d;;){for(var M=Math.floor(((m-w+1)*i-1)/b),A=0,N=r;N-A>1;){var I=A+N>>>1;M>>1|h(),E=E<<1^f,x=(x^f)<<1|f|1;w=E,b=1+x-E}var k=r-4;return v.map((function(e){switch(e-k){case 3:return k+65792+(t[u++]<<16|t[u++]<<8|t[u++]);case 2:return k+256+(t[u++]<<8|t[u++]);case 1:return k+t[u++];default:return e-1}}))}(t))}(function(t){t=atob(t);for(var e=[],n=0;n>=1),check:2==o}}()}(xe),new Nt(ge),new Uint8Array(32).fill(0),new Nt("rlp/5.7.0");var Te=new Nt("address/5.7.0");function Le(t){St(t,20)||Te.throwArgumentError("invalid address","address",t);for(var e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40),r=0;r<40;r++)n[r]=e[r].charCodeAt(0);for(var i=Lt(Pt(n)),o=0;o<40;o+=2)i[o>>1]>>4>=8&&(e[o]=e[o].toUpperCase()),(15&i[o>>1])>=8&&(e[o+1]=e[o+1].toUpperCase());return"0x"+e.join("")}for(var Se={},je=0;je<10;je++)Se[String(je)]=String(je);for(var Ce=0;Ce<26;Ce++)Se[String.fromCharCode(65+Ce)]=String(10+Ce);var De=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Oe(t,e,n){Object.defineProperty(t,e,{enumerable:!0,value:n,writable:!1})}new Nt("properties/5.7.0"),new Nt(ge),new Uint8Array(32).fill(0),Ht.from(-1);var ze=Ht.from(0),Pe=Ht.from(1);Ht.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Ot(Pe.toHexString(),32),Ot(ze.toHexString(),32);var _e={},Be={},Re=Ue;function Ue(t,e){if(!t)throw new Error(e||"Assertion failed")}Ue.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var Qe={exports:{}};"function"==typeof Object.create?Qe.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Qe.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}};var Ye=Re,We=Qe.exports;function Fe(t,e){return!(55296!=(64512&t.charCodeAt(e))||e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function Ve(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function He(t){return 1===t.length?"0"+t:t}function Ge(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}Be.inherits=We,Be.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,n[r++]=63&o|128):Fe(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i>>0}return o},Be.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},Be.rotr32=function(t,e){return t>>>e|t<<32-e},Be.rotl32=function(t,e){return t<>>32-e},Be.sum32=function(t,e){return t+e>>>0},Be.sum32_3=function(t,e,n){return t+e+n>>>0},Be.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},Be.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},Be.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o>>0,t[e+1]=o},Be.sum64_hi=function(t,e,n,r){return(e+r>>>0>>0},Be.sum64_lo=function(t,e,n,r){return e+r>>>0},Be.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)>>0)>>0)>>0},Be.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},Be.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)>>0)>>0)>>0)>>0},Be.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},Be.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},Be.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},Be.shr64_hi=function(t,e,n){return t>>>n},Be.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var qe={},Ze=Be,Je=Re;function Xe(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}qe.BlockHash=Xe,Xe.prototype.update=function(t,e){if(t=Ze.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=Ze.join32(t,0,t.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},$e.g1_256=function(t){return tn(t,17)^tn(t,19)^t>>>10};var on=Be,an=qe,sn=$e,un=on.rotl32,cn=on.sum32,ln=on.sum32_5,hn=sn.ft_1,dn=an.BlockHash,fn=[1518500249,1859775393,2400959708,3395469782];function pn(){if(!(this instanceof pn))return new pn;dn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}on.inherits(pn,dn);var yn=pn;pn.blockSize=512,pn.outSize=160,pn.hmacStrength=80,pn.padLength=64,pn.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;rthis.blockSize&&(t=(new this.Hash).update(t).digest()),Or(t.length<=this.blockSize);for(var e=t.length;e>8,a=255&i;o?n.push(o,a):n.push(a)}return n},n.zero2=r,n.toHex=i,n.encode=function(t,e){return"hex"===e?i(t):t}})),Qr=_r((function(t,e){var n=e;n.assert=Br,n.toArray=Ur.toArray,n.zero2=Ur.zero2,n.toHex=Ur.toHex,n.encode=Ur.encode,n.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},n.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=1&u?3!=(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u:0,n[0].push(a),s=1&c?3!=(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c:0,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},n.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new Rt(t,"hex","le")}})),Yr=Qr.getNAF,Wr=Qr.getJSF,Fr=Qr.assert;function Vr(t,e){this.type=t,this.p=new Rt(e.p,16),this.red=e.prime?Rt.red(e.prime):Rt.mont(this.p),this.zero=new Rt(0).toRed(this.red),this.one=new Rt(1).toRed(this.red),this.two=new Rt(2).toRed(this.red),this.n=e.n&&new Rt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hr=Vr;function Gr(t,e){this.curve=t,this.type=e,this.precomputed=null}Vr.prototype.point=function(){throw new Error("Not implemented")},Vr.prototype.validate=function(){throw new Error("Not implemented")},Vr.prototype._fixedNafMul=function(t,e){Fr(t.precomputed);var n=t._getDoubles(),r=Yr(e,1,this._bitLength),i=(1<=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];Fr(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},Vr.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var y=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(y[1]=e[f].add(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].add(e[p].neg())):(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=Wr(n[f],n[p]);for(h=Math.max(g[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a=0;o--){for(var A=0;o>=0;){var N=!0;for(a=0;a=0&&A++,b=b.dblp(A),o<0)break;for(a=0;a0?s=c[a][I-1>>1]:I<0&&(s=c[a][-I-1>>1].neg()),b="affine"===s.type?b.mixedAdd(s):b.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},Gr.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},Jr.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},Jr.prototype.pointFromX=function(t,e){(t=new Rt(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},Jr.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Jr.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},Kr.prototype.isInfinity=function(){return this.inf},Kr.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},Kr.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Kr.prototype.getX=function(){return this.x.fromRed()},Kr.prototype.getY=function(){return this.y.fromRed()},Kr.prototype.mul=function(t){return t=new Rt(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Kr.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},Kr.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},Kr.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Kr.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},Kr.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},qr($r,Hr.BasePoint),Jr.prototype.jpoint=function(t,e,n){return new $r(this,t,e,n)},$r.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},$r.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$r.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},$r.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},$r.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},$r.prototype.inspect=function(){return this.isInfinity()?"":""},$r.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var ti=_r((function(t,e){var n=e;n.base=Hr,n.short=Xr,n.mont=null,n.edwards=null})),ei=_r((function(t,e){var n,r=e,i=Qr.assert;function o(t){"short"===t.type?this.curve=new ti.short(t):"edwards"===t.type?this.curve=new ti.edwards(t):this.curve=new ti.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new o(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:_e.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:_e.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:_e.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:_e.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:_e.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_e.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_e.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(t){n=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:_e.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function ni(t){if(!(this instanceof ni))return new ni(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Ur.toArray(t.entropy,t.entropyEnc||"hex"),n=Ur.toArray(t.nonce,t.nonceEnc||"hex"),r=Ur.toArray(t.pers,t.persEnc||"hex");Br(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var ri=ni;ni.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},ni.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=Ur.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var si=Qr.assert;function ui(t,e){if(t instanceof ui)return t;this._importDER(t,e)||(si(t.r&&t.s,"Signature without r or s"),this.r=new Rt(t.r,16),this.s=new Rt(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var ci=ui;function li(){this.place=0}function hi(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o>>=0;return!(i<=127)&&(e.place=a,i)}function di(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}ui.prototype._importDER=function(t,e){t=Qr.toArray(t,e);var n=new li;if(48!==t[n.place++])return!1;var r=hi(t,n);if(!1===r||r+n.place!==t.length||2!==t[n.place++])return!1;var i=hi(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=hi(t,n);if(!1===a||t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new Rt(o),this.s=new Rt(s),this.recoveryParam=null,!0},ui.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=di(e),n=di(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];fi(r,e.length),(r=r.concat(e)).push(2),fi(r,n.length);var i=r.concat(n),o=[48];return fi(o,i.length),o=o.concat(i),Qr.encode(o,t)};var pi=function(){throw new Error("unsupported")},yi=Qr.assert;function mi(t){if(!(this instanceof mi))return new mi(t);"string"==typeof t&&(yi(Object.prototype.hasOwnProperty.call(ei,t),"Unknown curve "+t),t=ei[t]),t instanceof ei.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var gi=mi;mi.prototype.keyPair=function(t){return new ai(this,t)},mi.prototype.keyFromPrivate=function(t,e){return ai.fromPrivate(this,t,e)},mi.prototype.keyFromPublic=function(t,e){return ai.fromPublic(this,t,e)},mi.prototype.genKeyPair=function(t){t||(t={});for(var e=new ri({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||pi(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new Rt(2));;){var i=new Rt(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},mi.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},mi.prototype.sign=function(t,e,n,r){"object"==N(n)&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new Rt(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new ri({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new Rt(1)),c=0;;c++){var l=r.k?r.k(c):new Rt(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new ci({r:f,s:p,recoveryParam:y})}}}}}},mi.prototype.verify=function(t,e,n,r){t=this._truncateToN(new Rt(t,16)),n=this.keyFromPublic(n,r);var i=(e=new ci(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},mi.prototype.recoverPubKey=function(t,e,n,r){yi((3&n)===n,"The recovery param is more than two bits"),e=new ci(e,r);var i=this.n,o=new Rt(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},mi.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new ci(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var vi=_r((function(t,e){var n=e;n.version="6.5.4",n.utils=Qr,n.rand=function(){throw new Error("unsupported")},n.curve=ti,n.curves=ei,n.ec=gi,n.eddsa=null})).ec,wi=new Nt("signing-key/5.7.0"),bi=null;function Mi(){return bi||(bi=new vi("secp256k1")),bi}var Ai,Ni=b((function t(e){v(this,t),Oe(this,"curve","secp256k1"),Oe(this,"privateKey",Ct(e)),32!==function(t){if("string"!=typeof t)t=Ct(t);else if(!St(t)||t.length%2)return null;return(t.length-2)/2}(this.privateKey)&&wi.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");var n=Mi().keyFromPrivate(Lt(this.privateKey));Oe(this,"publicKey","0x"+n.getPublic(!1,"hex")),Oe(this,"compressedPublicKey","0x"+n.getPublic(!0,"hex")),Oe(this,"_isSigningKey",!0)}),[{key:"_addPoint",value:function(t){var e=Mi().keyFromPublic(Lt(this.publicKey)),n=Mi().keyFromPublic(Lt(t));return"0x"+e.pub.add(n.pub).encodeCompressed("hex")}},{key:"signDigest",value:function(t){var e=Mi().keyFromPrivate(Lt(this.privateKey)),n=Lt(t);32!==n.length&&wi.throwArgumentError("bad digest length","digest",t);var r=e.sign(n,{canonical:!0});return zt({recoveryParam:r.recoveryParam,r:Ot("0x"+r.r.toString(16),32),s:Ot("0x"+r.s.toString(16),32)})}},{key:"computeSharedSecret",value:function(t){var e=Mi().keyFromPrivate(Lt(this.privateKey)),n=Mi().keyFromPublic(Lt(Ii(t)));return Ot("0x"+e.derive(n.getPublic()).toString(16),32)}}],[{key:"isSigningKey",value:function(t){return!(!t||!t._isSigningKey)}}]);function Ii(t,e){var n=Lt(t);if(32===n.length){var r=new Ni(n);return e?"0x"+Mi().keyFromPrivate(n).getPublic(!0,"hex"):r.publicKey}return 33===n.length?e?Ct(n):"0x"+Mi().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?e?"0x"+Mi().keyFromPublic(n).getPublic(!0,"hex"):Ct(n):wi.throwArgumentError("invalid public or private key","key","[REDACTED]")}function Ei(t,e){return function(t){return function(t){var e=null;if("string"!=typeof t&&Te.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Le(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Te.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){for(var e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((function(t){return Se[t]})).join("");e.length>=De;){var n=e.substring(0,De);e=parseInt(n,10)%97+e.substring(n.length)}for(var r=String(98-parseInt(e,10)%97);r.length<2;)r="0"+r;return r}(t)&&Te.throwArgumentError("bad icap checksum","address",t),e=function(t){return new Qt(t,36).toString(16)}(t.substring(4));e.length<40;)e="0"+e;e=Le("0x"+e)}else Te.throwArgumentError("invalid address","address",t);return e}(Dt(Pt(Dt(Ii(t),1)),12))}(function(t,e){var n=zt(e),r={r:Lt(n.r),s:Lt(n.s)};return"0x"+Mi().recoverPubKey(Lt(t),r,n.recoveryParam).encode("hex",!1)}(Lt(t),e))}function xi(t,e,n,r,i,o){return L(this,null,A().mark((function a(){return A().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:a.t0=n.t,a.next="eip191"===a.t0?3:"eip1271"===a.t0?4:7;break;case 3:return a.abrupt("return",ki(t,e,n.s));case 4:return a.next=6,Ti(t,e,n.s,r,i,o);case 6:return a.abrupt("return",a.sent);case 7:throw new Error("verifySignature failed: Attempted to verify CacaoSignature with unknown type: ".concat(n.t));case 8:case"end":return a.stop()}}),a)})))}function ki(t,e,n){return Ei(ke(e),n).toLowerCase()===t.toLowerCase()}function Ti(t,e,n,r,i,o){return L(this,null,A().mark((function a(){var s,u,c,l,h,d,f;return A().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,s="0x1626ba7e",u=n.substring(2),c=ke(e).substring(2),l=s+c+"00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041"+u,a.next=9,fetch("".concat(o||"https://rpc.walletconnect.com/v1","/?chainId=").concat(r,"&projectId=").concat(i),{method:"POST",body:JSON.stringify({id:Date.now()+Math.floor(1e3*Math.random()),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:l},"latest"]})});case 9:return h=a.sent,a.next=12,h.json();case 12:return d=a.sent,f=d.result,a.abrupt("return",!!f&&f.slice(0,s.length).toLowerCase()===s.toLowerCase());case 17:return a.prev=17,a.t0=a.catch(0),a.abrupt("return",(console.error("isValidEip1271Signature: ",a.t0),!1));case 20:case"end":return a.stop()}}),a,null,[[0,17]])})))}new Nt("transactions/5.7.0"),function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(Ai||(Ai={}));var Li=Object.defineProperty,Si=Object.defineProperties,ji=Object.getOwnPropertyDescriptors,Ci=Object.getOwnPropertySymbols,Di=Object.prototype.hasOwnProperty,Oi=Object.prototype.propertyIsEnumerable,zi=function(t,e,n){return e in t?Li(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},Pi=function(t){return null==t?void 0:t.split(":")},_i=function(t){var e=t&&Pi(t);if(e)return t.includes("did:pkh:")?e[3]:e[1]},Bi=function(t){var e=t&&Pi(t);if(e)return e[2]+":"+e[3]},Ri=function(t){var e=t&&Pi(t);if(e)return e.pop()};function Ui(t){return L(this,null,A().mark((function e(){var n,r,i,o,a,s;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.cacao,r=t.projectId,i=n.s,o=n.p,a=Qi(o,o.iss),s=Ri(o.iss),e.next=3,xi(s,a,i,_i(o.iss),r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))}var Qi=function(t,e){var n="".concat(t.domain," wants you to sign in with your Ethereum account:"),r=Ri(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");var i=t.statement||void 0,o="URI: ".concat(t.aud||t.uri),a="Version: ".concat(t.version),s="Chain ID: ".concat(_i(e)),u="Nonce: ".concat(t.nonce),c="Issued At: ".concat(t.iat),l=t.resources?"Resources:".concat(t.resources.map((function(t){return"\n- ".concat(t)})).join("")):void 0,h=Ji(t.resources);return h&&(i=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0;Yi(e);var n="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(n))return t;var r=[],i=0;Object.keys(e.att).forEach((function(t){var n=Object.keys(e.att[t]).map((function(t){return{ability:t.split("/")[0],action:t.split("/")[1]}}));n.sort((function(t,e){return t.action.localeCompare(e.action)}));var o={};n.forEach((function(t){o[t.ability]||(o[t.ability]=[]),o[t.ability].push(t.action)}));var a=Object.keys(o).map((function(e){return i++,"(".concat(i,") '").concat(e,"': '").concat(o[e].join("', '"),"' for '").concat(t,"'.")}));r.push(a.join(", ").replace(".,","."))}));var o=r.join(" "),a="".concat(n).concat(o);return"".concat(t?t+" ":"").concat(a)}(i,Vi(h))),[n,r,"",i,"",o,a,s,u,c,l].filter((function(t){return null!=t})).join("\n")};function Yi(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");var e=Object.keys(t.att);if(null==e||!e.length)throw new Error("No resources found in `att` property");e.forEach((function(e){var n=t.att[e];if(Array.isArray(n))throw new Error("Resource must be an object: ".concat(e));if("object"!=N(n))throw new Error("Resource must be an object: ".concat(e));if(!Object.keys(n).length)throw new Error("Resource object is empty: ".concat(e));Object.keys(n).forEach((function(t){var e=n[t];if(!Array.isArray(e))throw new Error("Ability limits ".concat(t," must be an array of objects, found: ").concat(e));if(!e.length)throw new Error("Value of ".concat(t," is empty array, must be an array with objects"));e.forEach((function(e){if("object"!=N(e))throw new Error("Ability limits (".concat(t,") must be an array of objects, found: ").concat(e))}))}))}))}function Wi(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(e=null==e?void 0:e.sort((function(t,e){return t.localeCompare(e)}))).map((function(e){return g({},"".concat(t,"/").concat(e),[n])}));return Object.assign.apply(Object,[{}].concat(E(r)))}function Fi(t){return Yi(t),"urn:recap:".concat(function(t){return i.from(JSON.stringify(t)).toString("base64")}(t).replace(/=/g,""))}function Vi(t){var e=function(t){return JSON.parse(i.from(t,"base64").toString("utf-8"))}(t.replace("urn:recap:",""));return Yi(e),e}function Hi(t,e,n){return Fi(function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return null==n||n.sort((function(t,e){return t.localeCompare(e)})),{att:g({},t,Wi(e,n,r))}}(t,e,n))}function Gi(t,e){return Fi(function(t,e){Yi(t),Yi(e);var n=Object.keys(t.att).concat(Object.keys(e.att)).sort((function(t,e){return t.localeCompare(e)})),r={att:{}};return n.forEach((function(n){var i,o;Object.keys((null==(i=t.att)?void 0:i[n])||{}).concat(Object.keys((null==(o=e.att)?void 0:o[n])||{})).sort((function(t,e){return t.localeCompare(e)})).forEach((function(i){var o,a;r.att[n]=function(t,e){return Si(t,ji(e))}(function(t,e){for(var n in e||(e={}))Di.call(e,n)&&zi(t,n,e[n]);if(Ci){var r,i=I(Ci(e));try{for(i.s();!(r=i.n()).done;)n=r.value,Oi.call(e,n)&&zi(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t}({},r.att[n]),g({},i,(null==(o=t.att[n])?void 0:o[i])||(null==(a=e.att[n])?void 0:a[i])))}))})),r}(Vi(t),Vi(e)))}function qi(t){var e,n=Vi(t);Yi(n);var r=null==(e=n.att)?void 0:e.eip155;return r?Object.keys(r).map((function(t){return t.split("/")[1]})):[]}function Zi(t){var e=Vi(t);Yi(e);var n=[];return Object.values(e.att).forEach((function(t){Object.values(t).forEach((function(t){var e;null!=(e=null==t?void 0:t[0])&&e.chains&&n.push(t[0].chains)}))})),E(new Set(n.flat()))}function Ji(t){if(t){var e=null==t?void 0:t[t.length-1];return function(t){return t&&t.includes("urn:recap:")}(e)?e:void 0}}var Xi="base16",Ki="base64pad",$i="utf8",to=1;function eo(){var t=p.generateKeyPair();return{privateKey:Object(y.toString)(t.secretKey,Xi),publicKey:Object(y.toString)(t.publicKey,Xi)}}function no(){var t=Object(d.randomBytes)(32);return Object(y.toString)(t,Xi)}function ro(t,e){var n=p.sharedKey(Object(y.fromString)(t,Xi),Object(y.fromString)(e,Xi),!0),r=new h.HKDF(f.SHA256,n).expand(32);return Object(y.toString)(r,Xi)}function io(t){var e=Object(f.hash)(Object(y.fromString)(t,Xi));return Object(y.toString)(e,Xi)}function oo(t){var e=Object(f.hash)(Object(y.fromString)(t,$i));return Object(y.toString)(e,Xi)}function ao(t){return Number(Object(y.toString)(t,"base10"))}function so(t){var e=function(t){return Object(y.fromString)("".concat(t),"base10")}(N(t.type)<"u"?t.type:0);if(ao(e)===to&&N(t.senderPublicKey)>"u")throw new Error("Missing sender public key for type 1 envelope");var n=N(t.senderPublicKey)<"u"?Object(y.fromString)(t.senderPublicKey,Xi):void 0,r=N(t.iv)<"u"?Object(y.fromString)(t.iv,Xi):Object(d.randomBytes)(12);return function(t){if(ao(t.type)===to){if(N(t.senderPublicKey)>"u")throw new Error("Missing sender public key for type 1 envelope");return Object(y.toString)(Object(y.concat)([t.type,t.senderPublicKey,t.iv,t.sealed]),Ki)}return Object(y.toString)(Object(y.concat)([t.type,t.iv,t.sealed]),Ki)}({type:e,sealed:new l.ChaCha20Poly1305(Object(y.fromString)(t.symKey,Xi)).seal(r,Object(y.fromString)(t.message,$i)),iv:r,senderPublicKey:n})}function uo(t){var e=new l.ChaCha20Poly1305(Object(y.fromString)(t.symKey,Xi)),n=co(t.encoded),r=n.sealed,i=n.iv,o=e.open(i,r);if(null===o)throw new Error("Failed to decrypt");return Object(y.toString)(o,$i)}function co(t){var e=Object(y.fromString)(t,Ki),n=e.slice(0,1);if(ao(n)===to){var r=e.slice(1,33),i=e.slice(33,45);return{type:n,sealed:e.slice(45),iv:i,senderPublicKey:r}}var o=e.slice(1,13);return{type:n,sealed:e.slice(13),iv:o}}function lo(t,e){var n=co(t);return ho({type:ao(n.type),senderPublicKey:N(n.senderPublicKey)<"u"?Object(y.toString)(n.senderPublicKey,Xi):void 0,receiverPublicKey:null==e?void 0:e.receiverPublicKey})}function ho(t){var e=(null==t?void 0:t.type)||0;if(e===to){if(N(null==t?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(N(null==t?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:null==t?void 0:t.senderPublicKey,receiverPublicKey:null==t?void 0:t.receiverPublicKey}}function fo(t){return t.type===to&&"string"==typeof t.senderPublicKey&&"string"==typeof t.receiverPublicKey}function po(t){return(null==t?void 0:t.relay)||{protocol:"irn"}}function yo(t){var e=m.RELAY_JSONRPC[t];if(N(e)>"u")throw new Error("Relay Protocol not supported: ".concat(t));return e}var mo=Object.defineProperty,go=Object.defineProperties,vo=Object.getOwnPropertyDescriptors,wo=Object.getOwnPropertySymbols,bo=Object.prototype.hasOwnProperty,Mo=Object.prototype.propertyIsEnumerable,Ao=function(t,e,n){return e in t?mo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},No=function(t,e){for(var n in e||(e={}))bo.call(e,n)&&Ao(t,n,e[n]);if(wo){var r,i=I(wo(e));try{for(i.s();!(r=i.n()).done;)n=r.value,Mo.call(e,n)&&Ao(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t};function Io(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",n={},r="relay"+e;return Object.keys(t).forEach((function(e){if(e.startsWith(r)){var i=e.replace(r,""),o=t[e];n[i]=o}})),n}function Eo(t){var e=(t=(t=t.includes("wc://")?t.replace("wc://",""):t).includes("wc:")?t.replace("wc:",""):t).indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e),i=t.substring(e+1,n).split("@"),o=N(n)<"u"?t.substring(n):"",a=c.parse(o),s="string"==typeof a.methods?a.methods.split(","):void 0;return{protocol:r,topic:xo(i[0]),version:parseInt(i[1],10),symKey:a.symKey,relay:Io(a),methods:s,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function xo(t){return t.startsWith("//")?t.substring(2):t}function ko(t){return"".concat(t.protocol,":").concat(t.topic,"@").concat(t.version,"?")+c.stringify(No(function(t,e){return go(t,vo(e))}(No({symKey:t.symKey},function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",n="relay",r={};return Object.keys(t).forEach((function(i){var o=n+e+i;t[i]&&(r[o]=t[i])})),r}(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function To(t){var e=[];return t.forEach((function(t){var n=x(t.split(":"),2),r=n[0],i=n[1];e.push("".concat(r,":").concat(i))})),e}function Lo(t,e){for(var n=function(t){var e={};return null==t||t.forEach((function(t){var n=x(t.split(":"),2),r=n[0],i=n[1];e[r]||(e[r]={accounts:[],chains:[],events:[]}),e[r].accounts.push(t),e[r].chains.push("".concat(r,":").concat(i))})),e}(e=e.map((function(t){return t.replace("did:pkh:","")}))),r=0,i=Object.entries(n);r"u"}function _o(t,e){return!(!e||!Po(t))||"string"==typeof t&&!!t.trim().length}function Bo(t,e){return!(!e||!Po(t))||"number"==typeof t&&!isNaN(t)}function Ro(t,e){var n=e.requiredNamespaces,r=Object.keys(t.namespaces),i=Object.keys(n),o=!0;return!!J(i,r)&&(r.forEach((function(e){var r=t.namespaces[e],i=r.accounts,a=r.methods,s=r.events,u=To(i),c=n[e];J(j(e,c),u)&&J(c.methods,a)&&J(c.events,s)||(o=!1)})),o)}function Uo(t){return!(!_o(t,!1)||!t.includes(":"))&&2===t.split(":").length}function Qo(t){if(_o(t,!1))try{return N(new URL(t))<"u"}catch(t){return!1}return!1}function Yo(t){var e;return null==(e=null==t?void 0:t.proposer)?void 0:e.publicKey}function Wo(t){return null==t?void 0:t.topic}function Fo(t,e){var n=null;return _o(null==t?void 0:t.publicKey,!1)||(n=Co("MISSING_OR_INVALID","".concat(e," controller public key should be a string"))),n}function Vo(t){var e=!0;return Oo(t)?t.length&&(e=t.every((function(t){return _o(t,!1)}))):e=!1,e}function Ho(t,e){var n=null;return Object.values(t).forEach((function(t){if(!n){var r=function(t,e){var n=null;return Vo(null==t?void 0:t.methods)?Vo(null==t?void 0:t.events)||(n=Do("UNSUPPORTED_EVENTS","".concat(e,", events should be an array of strings or empty array for no events"))):n=Do("UNSUPPORTED_METHODS","".concat(e,", methods should be an array of strings or empty array for no methods")),n}(t,"".concat(e,", namespace"));r&&(n=r)}})),n}function Go(t,e,n){var r=null;if(t&&zo(t)){var i=Ho(t,e);i&&(r=i);var o=function(t,e,n){var r=null;return Object.entries(t).forEach((function(t){var i=x(t,2),o=i[0],a=i[1];if(!r){var s=function(t,e,n){var r=null;return Oo(e)&&e.length?e.forEach((function(t){r||Uo(t)||(r=Do("UNSUPPORTED_CHAINS","".concat(n,", chain ").concat(t,' should be a string and conform to "namespace:chainId" format')))})):Uo(t)||(r=Do("UNSUPPORTED_CHAINS","".concat(n,', chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }'))),r}(o,j(o,a),"".concat(e," ").concat(n));s&&(r=s)}})),r}(t,e,n);o&&(r=o)}else r=Co("MISSING_OR_INVALID","".concat(e,", ").concat(n," should be an object with data"));return r}function qo(t,e){var n=null;if(t&&zo(t)){var r=Ho(t,e);r&&(n=r);var i=function(t,e){var n=null;return Object.values(t).forEach((function(t){if(!n){var r=function(t,e){var n=null;return Oo(t)?t.forEach((function(t){n||function(t){if(_o(t,!1)&&t.includes(":")){var e=t.split(":");if(3===e.length){var n=e[0]+":"+e[1];return!!e[2]&&Uo(n)}}return!1}(t)||(n=Do("UNSUPPORTED_ACCOUNTS","".concat(e,", account ").concat(t,' should be a string and conform to "namespace:chainId:address" format')))})):n=Do("UNSUPPORTED_ACCOUNTS","".concat(e,', accounts should be an array of strings conforming to "namespace:chainId:address" format')),n}(null==t?void 0:t.accounts,"".concat(e," namespace"));r&&(n=r)}})),n}(t,e);i&&(n=i)}else n=Co("MISSING_OR_INVALID","".concat(e,", namespaces should be an object with data"));return n}function Zo(t){return _o(t.protocol,!0)}function Jo(t,e){var n=!1;return e&&!t?n=!0:t&&Oo(t)&&t.length&&t.forEach((function(t){n=Zo(t)})),n}function Xo(t){return"number"==typeof t}function Ko(t){return N(t)<"u"&&null!==N(t)}function $o(t){return!!(t&&"object"==N(t)&&t.code&&Bo(t.code,!1)&&t.message&&_o(t.message,!1))}function ta(t){return!(Po(t)||!_o(t.method,!1))}function ea(t){return!(Po(t)||Po(t.result)&&Po(t.error)||!Bo(t.id,!1)||!_o(t.jsonrpc,!1))}function na(t){return!(Po(t)||!_o(t.name,!1))}function ra(t,e){return!(!Uo(e)||!function(t){var e=[];return Object.values(t).forEach((function(t){e.push.apply(e,E(To(t.accounts)))})),e}(t).includes(e))}function ia(t,e,n){return!!_o(n,!1)&&function(t,e){var n=[];return Object.values(t).forEach((function(t){To(t.accounts).includes(e)&&n.push.apply(n,E(t.methods))})),n}(t,e).includes(n)}function oa(t,e,n){return!!_o(n,!1)&&function(t,e){var n=[];return Object.values(t).forEach((function(t){To(t.accounts).includes(e)&&n.push.apply(n,E(t.events))})),n}(t,e).includes(n)}function aa(t,e,n){var r=null,i=function(t){var e={};return Object.keys(t).forEach((function(n){var r;n.includes(":")?e[n]=t[n]:null==(r=t[n].chains)||r.forEach((function(r){e[r]={methods:t[n].methods,events:t[n].events}}))})),e}(t),o=function(t){var e={};return Object.keys(t).forEach((function(n){if(n.includes(":"))e[n]=t[n];else{var r=To(t[n].accounts);null==r||r.forEach((function(r){e[r]={accounts:t[n].accounts.filter((function(t){return t.includes("".concat(r,":"))})),methods:t[n].methods,events:t[n].events}}))}})),e}(e),a=Object.keys(i),s=Object.keys(o),u=sa(Object.keys(t)),c=sa(Object.keys(e)),l=u.filter((function(t){return!c.includes(t)}));return l.length&&(r=Co("NON_CONFORMING_NAMESPACES","".concat(n," namespaces keys don't satisfy requiredNamespaces.\n Required: ").concat(l.toString(),"\n Received: ").concat(Object.keys(e).toString()))),J(a,s)||(r=Co("NON_CONFORMING_NAMESPACES","".concat(n," namespaces chains don't satisfy required namespaces.\n Required: ").concat(a.toString(),"\n Approved: ").concat(s.toString()))),Object.keys(e).forEach((function(t){if(t.includes(":")&&!r){var i=To(e[t].accounts);i.includes(t)||(r=Co("NON_CONFORMING_NAMESPACES","".concat(n," namespaces accounts don't satisfy namespace accounts for ").concat(t,"\n Required: ").concat(t,"\n Approved: ").concat(i.toString())))}})),a.forEach((function(t){r||(J(i[t].methods,o[t].methods)?J(i[t].events,o[t].events)||(r=Co("NON_CONFORMING_NAMESPACES","".concat(n," namespaces events don't satisfy namespace events for ").concat(t))):r=Co("NON_CONFORMING_NAMESPACES","".concat(n," namespaces methods don't satisfy namespace methods for ").concat(t)))})),r}function sa(t){return E(new Set(t.map((function(t){return t.includes(":")?t.split(":")[0]:t}))))}function ua(t,e){return Bo(t,!1)&&t<=e.max&&t>=e.min}function ca(){var t=V();return new Promise((function(e){switch(t){case U:e(F()&&(null==navigator?void 0:navigator.onLine));break;case B:e(function(){return L(this,null,A().mark((function t(){var e;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(W()&&(void 0===r?"undefined":N(r))<"u"&&null!=r&&r.NetInfo)){t.next=5;break}return t.next=3,null==r?void 0:r.NetInfo.fetch();case 3:return e=t.sent,t.abrupt("return",null==e?void 0:e.isConnected);case 5:return t.abrupt("return",!0);case 6:case"end":return t.stop()}}),t)})))}());break;case R:e(!0);break;default:e(!0)}}))}function la(t){switch(V()){case U:!function(t){!W()&&F()&&(window.addEventListener("online",(function(){return t(!0)})),window.addEventListener("offline",(function(){return t(!1)})))}(t);break;case B:!function(t){W()&&(void 0===r?"undefined":N(r))<"u"&&null!=r&&r.NetInfo&&(null==r||r.NetInfo.addEventListener((function(e){return t(null==e?void 0:e.isConnected)})))}(t)}}var ha={},da=b((function t(){v(this,t)}),null,[{key:"get",value:function(t){return ha[t]}},{key:"set",value:function(t,e){ha[t]=e}},{key:"delete",value:function(t){delete ha[t]}}])}).call(this,n(33),n(26),n(116).Buffer)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(16);r.__exportStar(n(76),e),r.__exportStar(n(81),e),r.__exportStar(n(82),e),r.__exportStar(n(45),e)},function(t,e,n){n(7);var r=n(25);n.d(e,"parseConnectionError",(function(){return r.d}));var i=n(54);n.o(i,"IJsonRpcProvider")&&n.d(e,"IJsonRpcProvider",(function(){return i.IJsonRpcProvider})),n.o(i,"formatJsonRpcError")&&n.d(e,"formatJsonRpcError",(function(){return i.formatJsonRpcError})),n.o(i,"formatJsonRpcRequest")&&n.d(e,"formatJsonRpcRequest",(function(){return i.formatJsonRpcRequest})),n.o(i,"formatJsonRpcResult")&&n.d(e,"formatJsonRpcResult",(function(){return i.formatJsonRpcResult})),n.o(i,"getBigIntRpcId")&&n.d(e,"getBigIntRpcId",(function(){return i.getBigIntRpcId})),n.o(i,"isJsonRpcError")&&n.d(e,"isJsonRpcError",(function(){return i.isJsonRpcError})),n.o(i,"isJsonRpcRequest")&&n.d(e,"isJsonRpcRequest",(function(){return i.isJsonRpcRequest})),n.o(i,"isJsonRpcResponse")&&n.d(e,"isJsonRpcResponse",(function(){return i.isJsonRpcResponse})),n.o(i,"isJsonRpcResult")&&n.d(e,"isJsonRpcResult",(function(){return i.isJsonRpcResult})),n.o(i,"isLocalhostUrl")&&n.d(e,"isLocalhostUrl",(function(){return i.isLocalhostUrl})),n.o(i,"isReactNative")&&n.d(e,"isReactNative",(function(){return i.isReactNative})),n.o(i,"isWsUrl")&&n.d(e,"isWsUrl",(function(){return i.isWsUrl})),n.o(i,"payloadId")&&n.d(e,"payloadId",(function(){return i.payloadId}));var o=n(55);n.d(e,"formatJsonRpcError",(function(){return o.a})),n.d(e,"formatJsonRpcRequest",(function(){return o.b})),n.d(e,"formatJsonRpcResult",(function(){return o.c})),n.d(e,"getBigIntRpcId",(function(){return o.d})),n.d(e,"payloadId",(function(){return o.e})),n(56);var a=n(63);n.d(e,"IJsonRpcProvider",(function(){return a.a}));var s=n(57);n.d(e,"isLocalhostUrl",(function(){return s.a})),n.d(e,"isWsUrl",(function(){return s.b}));var u=n(58);n.d(e,"isJsonRpcError",(function(){return u.a})),n.d(e,"isJsonRpcRequest",(function(){return u.b})),n.d(e,"isJsonRpcResponse",(function(){return u.c})),n.d(e,"isJsonRpcResult",(function(){return u.d}))},function(t,e,n){n.d(e,"h",(function(){return r})),n.d(e,"i",(function(){return i})),n.d(e,"f",(function(){return o})),n.d(e,"g",(function(){return a})),n.d(e,"e",(function(){return s})),n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return c})),n.d(e,"d",(function(){return l})),n.d(e,"c",(function(){return h})),n.d(e,"l",(function(){return d})),n.d(e,"k",(function(){return f})),n.d(e,"m",(function(){return p})),n.d(e,"n",(function(){return y})),n.d(e,"j",(function(){return m}));var r="EdDSA",i="JWT",o=".",a="base64url",s="utf8",u="utf8",c=":",l="did",h="key",d="base58btc",f="z",p="K36",y=32,m=32},function(t,e,n){n.d(e,"a",(function(){return D})),n.d(e,"b",(function(){return O})),n.d(e,"c",(function(){return T})),n.d(e,"d",(function(){return j}));var r=n(15),i=n.n(r);n.d(e,"e",(function(){return i.a}));var o=n(8);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nthis.maxSizeInBytes)throw new Error("[LinkedList] Value too big to insert into list: ".concat(t," with size ").concat(e.size));for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}},{key:"shift",value:function(){if(this.head){var t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}}},{key:"toArray",value:function(){for(var t=[],e=this.head;null!==e;)t.push(e.value),e=e.next;return t}},{key:"length",get:function(){return this.lengthInNodes}},{key:"size",get:function(){return this.sizeInBytes}},{key:"toOrderedArray",value:function(){return Array.from(this)}},{key:Symbol.iterator,value:function(){var t=this.head;return{next:function(){if(!t)return{done:!0,value:null};var e=t.value;return t=t.next,{done:!1,value:e}}}}}]),m=l((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,t),this.level=null!=e?e:"error",this.levelValue=r.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new y(this.MAX_LOG_SIZE_IN_BYTES)}),[{key:"forwardToConsole",value:function(t,e){e===r.levels.values.error?console.error(t):e===r.levels.values.warn?console.warn(t):e===r.levels.values.debug?console.debug(t):e===r.levels.values.trace?console.trace(t):console.log(t)}},{key:"appendToLogs",value:function(t){this.logs.append(Object(o.b)({timestamp:(new Date).toISOString(),log:t}));var e="string"==typeof t?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}},{key:"getLogs",value:function(){return this.logs}},{key:"clearLogs",value:function(){this.logs=new y(this.MAX_LOG_SIZE_IN_BYTES)}},{key:"getLogArray",value:function(){return Array.from(this.logs)}},{key:"logsToBlob",value:function(t){var e=this.getLogArray();return e.push(Object(o.b)({extraMetadata:t})),new Blob(e,{type:"application/json"})}}]),g=l((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,t),this.baseChunkLogger=new m(e,n)}),[{key:"write",value:function(t){this.baseChunkLogger.appendToLogs(t)}},{key:"getLogs",value:function(){return this.baseChunkLogger.getLogs()}},{key:"clearLogs",value:function(){this.baseChunkLogger.clearLogs()}},{key:"getLogArray",value:function(){return this.baseChunkLogger.getLogArray()}},{key:"logsToBlob",value:function(t){return this.baseChunkLogger.logsToBlob(t)}},{key:"downloadLogsBlobInBrowser",value:function(t){var e=URL.createObjectURL(this.logsToBlob(t)),n=document.createElement("a");n.href=e,n.download="walletconnect-logs-".concat((new Date).toISOString(),".txt"),document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}}]),v=l((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,t),this.baseChunkLogger=new m(e,n)}),[{key:"write",value:function(t){this.baseChunkLogger.appendToLogs(t)}},{key:"getLogs",value:function(){return this.baseChunkLogger.getLogs()}},{key:"clearLogs",value:function(){this.baseChunkLogger.clearLogs()}},{key:"getLogArray",value:function(){return this.baseChunkLogger.getLogArray()}},{key:"logsToBlob",value:function(t){return this.baseChunkLogger.logsToBlob(t)}}]),w=Object.defineProperty,b=Object.defineProperties,M=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,E=function(t,e,n){return e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},x=function(t,e){for(var n in e||(e={}))N.call(e,n)&&E(t,n,e[n]);if(A){var r,i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw o}}}}(A(e));try{for(i.s();!(r=i.n()).done;)n=r.value,I.call(e,n)&&E(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},k=function(t,e){return b(t,M(e))};function T(t){return k(x({},t),{level:(null==t?void 0:t.level)||"info"})}function L(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;return t[e]||""}function S(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d;return t[n]=e,t}function j(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;return s(t.bindings)>"u"?L(t,e):t.bindings().context||""}function C(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,r=j(t,n);return r.trim()?"".concat(r,"/").concat(e):e}function D(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,r=C(t,e,n),i=t.child({context:r});return S(i,r,n)}function O(t){return s(t.loggerOverride)<"u"&&"string"!=typeof t.loggerOverride?{logger:t.loggerOverride,chunkLoggerController:null}:("undefined"==typeof window?"undefined":s(window))<"u"?function(t){var e,n,r=new g(null==(e=t.opts)?void 0:e.level,t.maxSizeInBytes);return{logger:i()(k(x({},t.opts),{level:"trace",browser:k(x({},null==(n=t.opts)?void 0:n.browser),{write:function(t){return r.write(t)}})})),chunkLoggerController:r}}(t):function(t){var e,n=new v(null==(e=t.opts)?void 0:e.level,t.maxSizeInBytes);return{logger:i()(k(x({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}(t)}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(109),i=n(42),o=n(110),a=n(17),s=n(20),u=n(111);e.compare=r.compare,e.concat=i.concat,e.equals=o.equals,e.fromString=a.fromString,e.toString=s.toString,e.xor=u.xor},function(t,e,n){var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}g(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&g(t,"error",e,{once:!0})}(t,i)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.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?s.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var i,o,a,s;if(c(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=l(t))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return t}function d(){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 f(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function p(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)o(u,this,e);else{var c=u.length,l=m(u,c);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):y.call(t,e)},s.prototype.listenerCount=y,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e,n){var i;return i=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e);if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e,"string"),(e="symbol"==r(i)?i:i+"")in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}n.d(e,"b",(function(){return o})),n.d(e,"d",(function(){return a})),n.d(e,"c",(function(){return s})),n.d(e,"e",(function(){return u})),n.d(e,"f",(function(){return c})),n.d(e,"a",(function(){return l}));var o="INTERNAL_ERROR",a="SERVER_ERROR",s=[-32700,-32600,-32601,-32602,-32603],u=[-32e3,-32099],c=i(i(i(i(i(i({},"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"}),o,{code:-32603,message:"Internal error"}),a,{code:-32e3,message:"Server error"}),l=a},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){if("string"!=typeof t)throw new Error("Cannot safe json parse value of type ".concat(r(t)));try{return e=t.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3'),JSON.parse(e,(function(t,e){return"string"==typeof e&&e.match(/^\d+n$/)?BigInt(e.substring(0,e.length-1)):e}))}catch(e){return t}var e}function o(t){return"string"==typeof t?t:(e=t,JSON.stringify(e,(function(t,e){return"bigint"==typeof e?e.toString()+"n":e}))||"");var e}n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o}))},function(t,e,n){(function(t){n.d(e,"a",(function(){return Ln})),n.d(e,"b",(function(){return _e})),n.d(e,"c",(function(){return De})),n.d(e,"d",(function(){return be})),n.d(e,"e",(function(){return Ne})),n.d(e,"f",(function(){return gn})),n.d(e,"g",(function(){return Re}));var r=n(6),i=n.n(r),o=n(64),a=n(27),s=n(4),u=n(11),c=n(8),l=n(31),h=n(0),d=n(5),f=n(1),p=n(72),y=n(2),m=n(65),g=n(66),v=n.n(g),w=n(67),b=n.n(w);function M(t){return function(t){if(Array.isArray(t))return P(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||z(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(t,e,n){return e=I(e),function(t,e){if(e&&("object"===k(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return N(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return!!t}()?Reflect.construct(e,n||[],I(t).constructor):e.apply(t,n))}function N(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function I(t){return(I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function E(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&x(t,e)}function x(t,e){return(x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function k(t){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function T(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */T=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof m?e:m,a=Object.create(o.prototype),s=new j(r||[]);return i(a,"_invoke",{value:E(t,n,s)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",f="executing",p="completed",y={};function m(){}function g(){}function v(){}var w={};c(w,a,(function(){return this}));var b=Object.getPrototypeOf,M=b&&b(b(C([])));M&&M!==n&&r.call(M,a)&&(w=M);var A=v.prototype=m.prototype=Object.create(w);function N(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function n(i,o,a,s){var u=h(t[i],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==k(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function E(e,n,r){var i=d;return function(o,a){if(i===f)throw Error("Generator is already running");if(i===p){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var u=x(s,r);if(u){if(u===y)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=h(e,n,r);if("normal"===c.type){if(i=r.done?p:"suspendedYield",c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=p,r.method="throw",r.arg=c.arg)}}}function x(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,x(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=h(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function L(t,e,n){return(e=D(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function S(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function j(t,e){for(var n=0;n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function z(t,e){if(t){if("string"==typeof t)return P(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r>>0,a=new Uint8Array(o);t[e];){var l=n[t.charCodeAt(e)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h>>0,a[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,e++}if(" "!==t[e]){for(var f=o-i;f!==o&&0===a[f];)f++;for(var p=new Uint8Array(r+(o-f)),y=r;f!==o;)p[y++]=a[f++];return p}}}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var a=(o-i)*l+1>>>0,c=new Uint8Array(a);i!==o;){for(var h=e[i],d=0,f=a-1;(0!==h||d>>0,c[f]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=a-r;p!==a&&0===c[p];)p++;for(var y=u.repeat(n);pn;)o+=e[i&s>>(a-=n)];if(a&&(o+=e[i&s<=8&&(u-=8,s[l++]=255&c>>u)}if(u>=n||255&c<<8-u)throw new SyntaxError("Unexpected end of data");return s}(t,i,r,e)}})},$=J({prefix:"\0",name:"identity",encode:function(t){return function(t){return(new TextDecoder).decode(t)}(t)},decode:function(t){return function(t){return(new TextEncoder).encode(t)}(t)}}),tt=Object.freeze({__proto__:null,identity:$}),et=K({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),nt=Object.freeze({__proto__:null,base2:et}),rt=K({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),it=Object.freeze({__proto__:null,base8:rt}),ot=X({prefix:"9",name:"base10",alphabet:"0123456789"}),at=Object.freeze({__proto__:null,base10:ot}),st=K({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ut=K({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),ct=Object.freeze({__proto__:null,base16:st,base16upper:ut}),lt=K({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ht=K({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),dt=K({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ft=K({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pt=K({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),yt=K({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),mt=K({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gt=K({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),vt=K({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),wt=Object.freeze({__proto__:null,base32:lt,base32upper:ht,base32pad:dt,base32padupper:ft,base32hex:pt,base32hexupper:yt,base32hexpad:mt,base32hexpadupper:gt,base32z:vt}),bt=X({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Mt=X({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),At=Object.freeze({__proto__:null,base36:bt,base36upper:Mt}),Nt=X({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),It=X({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Et=Object.freeze({__proto__:null,base58btc:Nt,base58flickr:It}),xt=K({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),kt=K({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Tt=K({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Lt=K({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),St=Object.freeze({__proto__:null,base64:xt,base64pad:kt,base64url:Tt,base64urlpad:Lt}),jt=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Ct=jt.reduce((function(t,e,n){return t[n]=e,t}),[]),Dt=jt.reduce((function(t,e,n){return t[e.codePointAt(0)]=n,t}),[]),Ot=J({prefix:"🚀",name:"base256emoji",encode:function(t){return t.reduce((function(t,e){return t+Ct[e]}),"")},decode:function(t){var e,n=[],r=O(t);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Dt[i.codePointAt(0)];if(void 0===o)throw new Error("Non-base256emoji character: ".concat(i));n.push(o)}}catch(t){r.e(t)}finally{r.f()}return new Uint8Array(n)}}),zt=Object.freeze({__proto__:null,base256emoji:Ot}),Pt=Math.pow(2,31),_t=Math.pow(2,7),Bt=Math.pow(2,14),Rt=Math.pow(2,21),Ut=Math.pow(2,28),Qt=Math.pow(2,35),Yt=Math.pow(2,42),Wt=Math.pow(2,49),Ft=Math.pow(2,56),Vt=Math.pow(2,63),Ht=function t(e,n,r){n=n||[];for(var i=r=r||0;e>=Pt;)n[r++]=255&e|128,e/=128;for(;-128&e;)n[r++]=255&e|128,e>>>=7;return n[r]=0|e,t.bytes=r-i+1,n},Gt=function(t){return t<_t?1:t2&&void 0!==arguments[2]?arguments[2]:0;return Ht(t,e,n),e},Zt=function(t){return Gt(t)},Jt=function(t,e){var n=e.byteLength,r=Zt(t),i=r+Zt(n),o=new Uint8Array(i+n);return qt(t,o,0),qt(n,o,r),o.set(e,i),new Xt(t,n,e,o)},Xt=C((function t(e,n,r,i){S(this,t),this.code=e,this.size=n,this.digest=r,this.bytes=i})),Kt=function(t){var e=t.name,n=t.code,r=t.encode;return new $t(e,n,r)},$t=C((function t(e,n,r){S(this,t),this.name=e,this.code=n,this.encode=r}),[{key:"digest",value:function(t){var e=this;if(t instanceof Uint8Array){var n=this.encode(t);return n instanceof Uint8Array?Jt(this.code,n):n.then((function(t){return Jt(e.code,t)}))}throw Error("Unknown type, must be binary type")}}]),te=function(t){return function(e){return W(void 0,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.t0=Uint8Array,n.next=3,crypto.subtle.digest(t,e);case 3:return n.t1=n.sent,n.abrupt("return",new n.t0(n.t1));case 5:case"end":return n.stop()}}),n)})))}},ee=Kt({name:"sha2-256",code:18,encode:te("SHA-256")}),ne=Kt({name:"sha2-512",code:19,encode:te("SHA-512")}),re=Object.freeze({__proto__:null,sha256:ee,sha512:ne}),ie=F,oe={code:0,name:"identity",encode:ie,digest:function(t){return Jt(0,ie(t))}},ae=Object.freeze({__proto__:null,identity:oe});new TextEncoder,new TextDecoder;var se=Y(Y(Y(Y(Y(Y(Y(Y(Y(Y({},tt),nt),it),at),ct),wt),At),Et),St),zt);function ue(t){return null!=globalThis.Buffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function ce(t,e,n,r){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:n},decoder:{decode:r}}}Y(Y({},re),ae);var le=ce("utf8","u",(function(t){return"u"+new TextDecoder("utf8").decode(t)}),(function(t){return(new TextEncoder).encode(t.substring(1))})),he=ce("ascii","a",(function(t){for(var e="a",n=0;n0&&void 0!==arguments[0]?arguments[0]:0;return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?ue(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}((t=t.substring(1)).length),n=0;n1&&void 0!==arguments[1]?arguments[1]:"utf8",n=de[e];if(!n)throw new Error('Unsupported encoding "'.concat(e,'"'));return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode("".concat(n.prefix).concat(t)):ue(globalThis.Buffer.from(t,"utf-8"))}var pe="core",ye="".concat("wc","@2:").concat(pe,":"),me={database:":memory:"},ge="client_ed25519_seed",ve=f.ONE_DAY,we=f.SIX_HOURS,be="irn",Me="wss://relay.walletconnect.com",Ae="wss://relay.walletconnect.org",Ne={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Ie="payload",Ee="connect",xe="disconnect",ke="error",Te=f.ONE_SECOND,Le="subscription_created",Se="subscription_deleted",je=(f.THIRTY_DAYS,1e3*f.FIVE_SECONDS),Ce=(f.THIRTY_DAYS,{wc_pairingDelete:{req:{ttl:f.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:f.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:f.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:f.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:f.ONE_DAY,prompt:!1,tag:0},res:{ttl:f.ONE_DAY,prompt:!1,tag:0}}}),De={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Oe="history_created",ze="history_updated",Pe="history_deleted",_e={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Be=(f.ONE_DAY,"verify-api"),Re="https://verify.walletconnect.com",Ue="https://verify.walletconnect.org",Qe=[Re,Ue],Ye=C((function t(e,n){var r=this;S(this,t),this.core=e,this.logger=n,this.keychain=new Map,this.name="keychain",this.version="0.3",this.initialized=!1,this.storagePrefix=ye,this.init=function(){return W(r,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.initialized){t.next=5;break}return t.next=3,this.getKeyChain();case 3:k(e=t.sent)<"u"&&(this.keychain=e),this.initialized=!0;case 5:case"end":return t.stop()}}),t,this)})))},this.has=function(t){return r.isInitialized(),r.keychain.has(t)},this.set=function(t,e){return W(r,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.keychain.set(t,e),n.next=4,this.persist();case 4:case"end":return n.stop()}}),n,this)})))},this.get=function(t){r.isInitialized();var e=r.keychain.get(t);if(k(e)>"u"){var n=Object(h.A)("NO_MATCHING_KEY","".concat(r.name,": ").concat(t)).message;throw new Error(n)}return e},this.del=function(t){return W(r,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),this.keychain.delete(t),e.next=4,this.persist();case 4:case"end":return e.stop()}}),e,this)})))},this.core=e,this.logger=Object(s.a)(n,this.name)}),[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"setKeyChain",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,Object(h.ob)(t));case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getKeyChain",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return e=t.sent,t.abrupt("return",k(e)<"u"?Object(h.qb)(e):void 0);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setKeyChain(this.keychain);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}]),We=C((function t(e,n,r){var i=this;S(this,t),this.core=e,this.logger=n,this.name="crypto",this.initialized=!1,this.init=function(){return W(i,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=5;break}return t.next=4,this.keychain.init();case 4:this.initialized=!0;case 5:case"end":return t.stop()}}),t,this)})))},this.hasKeys=function(t){return i.isInitialized(),i.keychain.has(t)},this.getClientId=function(){return W(i,null,T().mark((function t(){var e,n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isInitialized(),t.next=3,this.getClientSeed();case 3:return e=t.sent,n=l.generateKeyPair(e),t.abrupt("return",l.encodeIss(n.publicKey));case 6:case"end":return t.stop()}}),t,this)})))},this.generateKeyPair=function(){i.isInitialized();var t=Object(h.t)();return i.setPrivateKey(t.publicKey,t.privateKey)},this.signJWT=function(t){return W(i,null,T().mark((function e(){var n,r,i,o;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.getClientSeed();case 3:return n=e.sent,r=l.generateKeyPair(n),i=Object(h.u)(),o=ve,e.next=9,l.signJWT(i,t,o,r);case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e,this)})))},this.generateSharedKey=function(t,e,n){i.isInitialized();var r=i.getPrivateKey(t),o=Object(h.k)(r,e);return i.setSymKey(o,n)},this.setSymKey=function(t,e){return W(i,null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),r=e||Object(h.I)(t),n.next=4,this.keychain.set(r,t);case 4:return n.abrupt("return",r);case 5:case"end":return n.stop()}}),n,this)})))},this.deleteKeyPair=function(t){return W(i,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.keychain.del(t);case 3:case"end":return e.stop()}}),e,this)})))},this.deleteSymKey=function(t){return W(i,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.keychain.del(t);case 3:case"end":return e.stop()}}),e,this)})))},this.encode=function(t,e,n){return W(i,null,T().mark((function r(){var i,o,a,s,u,l,d;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this.isInitialized(),i=Object(h.wb)(n),o=Object(c.b)(e),!Object(h.T)(i)){r.next=7;break}return a=i.senderPublicKey,s=i.receiverPublicKey,r.next=6,this.generateSharedKey(a,s);case 6:t=r.sent;case 7:return u=this.getSymKey(t),l=i.type,d=i.senderPublicKey,r.abrupt("return",Object(h.m)({type:l,symKey:u,message:o,senderPublicKey:d}));case 9:case"end":return r.stop()}}),r,this)})))},this.decode=function(t,e,n){return W(i,null,T().mark((function r(){var i,o,a,s,u;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this.isInitialized(),i=Object(h.vb)(e,n),!Object(h.T)(i)){r.next=7;break}return o=i.receiverPublicKey,a=i.senderPublicKey,r.next=6,this.generateSharedKey(o,a);case 6:t=r.sent;case 7:return r.prev=7,s=this.getSymKey(t),u=Object(h.j)({symKey:s,encoded:e}),r.abrupt("return",Object(c.a)(u));case 12:return r.prev=12,r.t0=r.catch(7),r.t1=this.logger,r.t2="Failed to decode message from topic: '".concat(t,"', clientId: '"),r.next=18,this.getClientId();case 18:r.t3=r.sent,r.t4=r.t2.concat.call(r.t2,r.t3,"'"),r.t1.error.call(r.t1,r.t4),this.logger.error(r.t0);case 22:case"end":return r.stop()}}),r,this,[[7,12]])})))},this.getPayloadType=function(t){var e=Object(h.l)(t);return Object(h.i)(e.type)},this.getPayloadSenderPublicKey=function(t){var e=Object(h.l)(t);return e.senderPublicKey?Object(d.toString)(e.senderPublicKey,h.a):void 0},this.core=e,this.logger=Object(s.a)(n,this.name),this.keychain=r||new Ye(this.core,this.logger)}),[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"setPrivateKey",value:function(t,e){return W(this,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.keychain.set(t,e);case 2:return n.abrupt("return",t);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"getPrivateKey",value:function(t){return this.keychain.get(t)}},{key:"getClientSeed",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e="",t.prev=1,e=this.keychain.get(ge),t.next=10;break;case 5:return t.prev=5,t.t0=t.catch(1),e=Object(h.u)(),t.next=10,this.keychain.set(ge,e);case 10:return t.abrupt("return",fe(e,"base16"));case 11:case"end":return t.stop()}}),t,this,[[1,5]])})))}},{key:"getSymKey",value:function(t){return this.keychain.get(t)}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}]),Fe=function(t){function e(t,n){var r;return S(this,e),(r=A(this,e,[t,n])).logger=t,r.core=n,r.messages=new Map,r.name="messages",r.version="0.3",r.initialized=!1,r.storagePrefix=ye,r.init=function(){return W(N(r),null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.initialized){t.next=15;break}return this.logger.trace("Initialized"),t.prev=2,t.next=5,this.getRelayerMessages();case 5:k(e=t.sent)<"u"&&(this.messages=e),this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",size:this.messages.size}),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(2),this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(t.t0);case 12:return t.prev=12,this.initialized=!0,t.finish(12);case 15:case"end":return t.stop()}}),t,this,[[2,9,12,15]])})))},r.set=function(t,e){return W(N(r),null,T().mark((function n(){var r,i;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),r=Object(h.J)(e),k(i=this.messages.get(t))>"u"&&(i={}),n.t0=k(i[r])<"u",n.t0){n.next=10;break}return i[r]=e,this.messages.set(t,i),n.next=10,this.persist();case 10:return n.abrupt("return",r);case 11:case"end":return n.stop()}}),n,this)})))},r.get=function(t){r.isInitialized();var e=r.messages.get(t);return k(e)>"u"&&(e={}),e},r.has=function(t,e){return r.isInitialized(),k(r.get(t)[Object(h.J)(e)])<"u"},r.del=function(t){return W(N(r),null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),this.messages.delete(t),e.next=4,this.persist();case 4:case"end":return e.stop()}}),e,this)})))},r.logger=Object(s.a)(t,r.name),r.core=n,r}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"setRelayerMessages",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,Object(h.ob)(t));case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getRelayerMessages",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return e=t.sent,t.abrupt("return",k(e)<"u"?Object(h.qb)(e):void 0);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setRelayerMessages(this.messages);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.f),Ve=function(t){function e(t,n){var i;return S(this,e),(i=A(this,e,[t,n])).relayer=t,i.logger=n,i.events=new r.EventEmitter,i.name="publisher",i.queue=new Map,i.publishTimeout=Object(f.toMiliseconds)(f.ONE_MINUTE),i.failedPublishTimeout=Object(f.toMiliseconds)(f.ONE_SECOND),i.needsTransportRestart=!1,i.publish=function(t,e,n){return W(N(i),null,T().mark((function r(){var i,o,a,s,u,c,l,d,f,p,m,g=this;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:t,message:e,opts:n}}),o=(null==n?void 0:n.ttl)||we,a=Object(h.F)(n),s=(null==n?void 0:n.prompt)||!1,u=(null==n?void 0:n.tag)||0,c=(null==n?void 0:n.id)||Object(y.getBigIntRpcId)().toString(),l={topic:t,message:e,opts:{ttl:o,relay:a,prompt:s,tag:u,id:c}},d="Failed to publish payload, please try again. id:".concat(c," tag:").concat(u),f=Date.now(),m=1,r.prev=3;case 4:if(void 0!==p){r.next=20;break}if(!(Date.now()-f>this.publishTimeout)){r.next=7;break}throw new Error(d);case 7:return this.logger.trace({id:c,attempts:m},"publisher.publish - attempt ".concat(m)),r.next=10,Object(h.h)(this.rpcPublish(t,e,o,a,s,u,c).catch((function(t){return g.logger.warn(t)})),this.publishTimeout,d);case 10:return r.next=12,r.sent;case 12:if(p=r.sent,m++,r.t0=p,r.t0){r.next=18;break}return r.next=18,new Promise((function(t){return setTimeout(t,g.failedPublishTimeout)}));case 18:r.next=4;break;case 20:this.relayer.events.emit(Ne.publish,l),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:c,topic:t,message:e,opts:n}}),r.next=28;break;case 23:if(r.prev=23,r.t1=r.catch(3),this.logger.debug("Failed to Publish Payload"),this.logger.error(r.t1),null==(i=null==n?void 0:n.internal)||!i.throwOnFailedPublish){r.next=27;break}throw r.t1;case 27:this.queue.set(c,l);case 28:case"end":return r.stop()}}),r,this,[[3,23]])})))},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.relayer=t,i.logger=Object(s.a)(n,i.name),i.registerEventListeners(),i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"rpcPublish",value:function(t,e,n,r,i,o,a){var s,u,c,l,d={method:Object(h.E)(r.protocol).publish,params:{topic:t,message:e,ttl:n,prompt:i,tag:o},id:a};return Object(h.U)(null==(s=d.params)?void 0:s.prompt)&&(null==(u=d.params)||delete u.prompt),Object(h.U)(null==(c=d.params)?void 0:c.tag)&&(null==(l=d.params)||delete l.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}},{key:"removeRequestFromQueue",value:function(t){this.queue.delete(t)}},{key:"checkQueue",value:function(){var t=this;this.queue.forEach((function(e){return W(t,null,T().mark((function t(){var n,r,i;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.topic,r=e.message,i=e.opts,t.next=3,this.publish(n,r,i);case 3:case"end":return t.stop()}}),t,this)})))}))}},{key:"registerEventListeners",value:function(){var t=this;this.relayer.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){if(t.needsTransportRestart)return t.needsTransportRestart=!1,void t.relayer.events.emit(Ne.connection_stalled);t.checkQueue()})),this.relayer.on(Ne.message_ack,(function(e){t.removeRequestFromQueue(e.id.toString())}))}}])}(u.g),He=C((function t(){var e=this;S(this,t),this.map=new Map,this.set=function(t,n){var r=e.get(t);e.exists(t,n)||e.map.set(t,[].concat(M(r),[n]))},this.get=function(t){return e.map.get(t)||[]},this.exists=function(t,n){return e.get(t).includes(n)},this.delete=function(t,n){if(k(n)>"u")e.map.delete(t);else if(e.map.has(t)){var r=e.get(t);if(e.exists(t,n)){var i=r.filter((function(t){return t!==n}));i.length?e.map.set(t,i):e.map.delete(t)}}},this.clear=function(){e.map.clear()}}),[{key:"topics",get:function(){return Array.from(this.map.keys())}}]),Ge=Object.defineProperty,qe=Object.defineProperties,Ze=Object.getOwnPropertyDescriptors,Je=Object.getOwnPropertySymbols,Xe=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable,$e=function(t,e,n){return e in t?Ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},tn=function(t,e){for(var n in e||(e={}))Xe.call(e,n)&&$e(t,n,e[n]);if(Je){var r,i=O(Je(e));try{for(i.s();!(r=i.n()).done;)n=r.value,Ke.call(e,n)&&$e(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},en=function(t,e){return qe(t,Ze(e))},nn=function(t){function e(t,n){var i;return S(this,e),(i=A(this,e,[t,n])).relayer=t,i.logger=n,i.subscriptions=new Map,i.topicMap=new He,i.events=new r.EventEmitter,i.name="subscription",i.version="0.3",i.pending=new Map,i.cached=[],i.initialized=!1,i.pendingSubscriptionWatchLabel="pending_sub_watch_label",i.pollingInterval=20,i.storagePrefix=ye,i.subscribeTimeout=Object(f.toMiliseconds)(f.ONE_MINUTE),i.restartInProgress=!1,i.batchSubscribeTopicsLimit=500,i.init=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=7;break}return this.logger.trace("Initialized"),this.registerEventListeners(),t.next=6,this.relayer.core.crypto.getClientId();case 6:this.clientId=t.sent;case 7:case"end":return t.stop()}}),t,this)})))},i.subscribe=function(t,e){return W(N(i),null,T().mark((function n(){var r,i,o;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.restartToComplete();case 2:return this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:t,opts:e}}),n.prev=5,r=Object(h.F)(e),i={topic:t,relay:r},this.pending.set(t,i),n.next=10,this.rpcSubscribe(t,r);case 10:return o=n.sent,n.abrupt("return",("string"==typeof o&&(this.onSubscribe(o,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:t,opts:e}})),o));case 14:throw n.prev=14,n.t0=n.catch(5),this.logger.debug("Failed to Subscribe Topic"),this.logger.error(n.t0),n.t0;case 17:case"end":return n.stop()}}),n,this,[[5,14]])})))},i.unsubscribe=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.restartToComplete();case 2:if(this.isInitialized(),!(k(null==e?void 0:e.id)<"u")){n.next=8;break}return n.next=6,this.unsubscribeById(t,e.id,e);case 6:n.next=10;break;case 8:return n.next=10,this.unsubscribeByTopic(t,e);case 10:case"end":return n.stop()}}),n,this)})))},i.isSubscribed=function(t){return W(N(i),null,T().mark((function e(){var n,r=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.topics.includes(t)){e.next=2;break}return e.abrupt("return",!0);case 2:return n="".concat(this.pendingSubscriptionWatchLabel,"_").concat(t),e.next=5,new Promise((function(e,i){var o=new f.Watch;o.start(n);var a=setInterval((function(){!r.pending.has(t)&&r.topics.includes(t)&&(clearInterval(a),o.stop(n),e(!0)),o.elapsed(n)>=je&&(clearInterval(a),o.stop(n),i(new Error("Subscription resolution timeout")))}),r.pollingInterval)})).catch((function(){return!1}));case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})))},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.start=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.onConnect();case 2:case"end":return t.stop()}}),t,this)})))},i.stop=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.onDisconnect();case 2:case"end":return t.stop()}}),t,this)})))},i.restart=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.restartInProgress=!0,t.next=3,this.restore();case 3:return t.next=5,this.reset();case 5:this.restartInProgress=!1;case 6:case"end":return t.stop()}}),t,this)})))},i.relayer=t,i.logger=Object(s.a)(n,i.name),i.clientId="",i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.subscriptions.size}},{key:"ids",get:function(){return Array.from(this.subscriptions.keys())}},{key:"values",get:function(){return Array.from(this.subscriptions.values())}},{key:"topics",get:function(){return this.topicMap.topics}},{key:"hasSubscription",value:function(t,e){var n=!1;try{n=this.getSubscription(t).topic===e}catch(t){}return n}},{key:"onEnable",value:function(){this.cached=[],this.initialized=!0}},{key:"onDisable",value:function(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}},{key:"unsubscribeByTopic",value:function(t,e){return W(this,null,T().mark((function n(){var r,i=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=this.topicMap.get(t),n.next=3,Promise.all(r.map((function(n){return W(i,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.unsubscribeById(t,n,e);case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))})));case 3:case"end":return n.stop()}}),n,this)})))}},{key:"unsubscribeById",value:function(t,e,n){return W(this,null,T().mark((function r(){var i,o;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}}),r.prev=1,i=Object(h.F)(n),r.next=5,this.rpcUnsubscribe(t,e,i);case 5:return o=Object(h.G)("USER_DISCONNECTED","".concat(this.name,", ").concat(t)),r.next=8,this.onUnsubscribe(t,e,o);case 8:this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}}),r.next=15;break;case 12:throw r.prev=12,r.t0=r.catch(1),this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(r.t0),r.t0;case 15:case"end":return r.stop()}}),r,this,[[1,12]])})))}},{key:"rpcSubscribe",value:function(t,e){return W(this,null,T().mark((function n(){var r,i=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r={method:Object(h.E)(e.protocol).subscribe,params:{topic:t}},this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),n.prev=2,n.next=5,Object(h.h)(this.relayer.request(r).catch((function(t){return i.logger.warn(t)})),this.subscribeTimeout);case 5:return n.next=7,n.sent;case 7:if(!n.sent){n.next=11;break}n.t0=Object(h.J)(t+this.clientId),n.next=12;break;case 11:n.t0=null;case 12:return n.abrupt("return",n.t0);case 15:n.prev=15,n.t1=n.catch(2),this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ne.connection_stalled);case 18:return n.abrupt("return",null);case 19:case"end":return n.stop()}}),n,this,[[2,15]])})))}},{key:"rpcBatchSubscribe",value:function(t){return W(this,null,T().mark((function e(){var n,r,i=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length){e.next=2;break}return e.abrupt("return");case 2:return n=t[0].relay,r={method:Object(h.E)(n.protocol).batchSubscribe,params:{topics:t.map((function(t){return t.topic}))}},this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),e.prev=4,e.next=7,Object(h.h)(this.relayer.request(r).catch((function(t){return i.logger.warn(t)})),this.subscribeTimeout);case 7:return e.next=9,e.sent;case 9:return e.abrupt("return",e.sent);case 12:e.prev=12,e.t0=e.catch(4),this.relayer.events.emit(Ne.connection_stalled);case 15:case"end":return e.stop()}}),e,this,[[4,12]])})))}},{key:"rpcUnsubscribe",value:function(t,e,n){var r={method:Object(h.E)(n.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}},{key:"onSubscribe",value:function(t,e){this.setSubscription(t,en(tn({},e),{id:t})),this.pending.delete(e.topic)}},{key:"onBatchSubscribe",value:function(t){var e=this;t.length&&t.forEach((function(t){e.setSubscription(t.id,tn({},t)),e.pending.delete(t.topic)}))}},{key:"onUnsubscribe",value:function(t,e,n){return W(this,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,n),r.next=4,this.relayer.messages.del(t);case 4:case"end":return r.stop()}}),r,this)})))}},{key:"setRelayerSubscriptions",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.relayer.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getRelayerSubscriptions",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.relayer.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"setSubscription",value:function(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}},{key:"addSubscription",value:function(t,e){this.subscriptions.set(t,tn({},e)),this.topicMap.set(e.topic,t),this.events.emit(Le,e)}},{key:"getSubscription",value:function(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});var e=this.subscriptions.get(t);if(!e){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw new Error(n)}return e}},{key:"deleteSubscription",value:function(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});var n=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(n.topic,t),this.events.emit(Se,en(tn({},n),{reason:e}))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setRelayerSubscriptions(this.values);case 2:this.events.emit("subscription_sync");case 3:case"end":return t.stop()}}),t,this)})))}},{key:"reset",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.cached.length){t.next=10;break}e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit),n=0;case 3:if(!(n"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.subscriptions.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),this.logger.error("".concat(this.name,": ").concat(JSON.stringify(this.values))),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored subscriptions for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",subscriptions:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore subscriptions for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"batchSubscribe",value:function(t){return W(this,null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.rpcBatchSubscribe(t);case 4:n=e.sent,Object(h.V)(n)&&this.onBatchSubscribe(n.map((function(e,n){return en(tn({},t[n]),{id:e})})));case 6:case"end":return e.stop()}}),e,this)})))}},{key:"onConnect",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.restart();case 2:this.onEnable();case 3:case"end":return t.stop()}}),t,this)})))}},{key:"onDisconnect",value:function(){this.onDisable()}},{key:"checkPending",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.initialized&&this.relayer.connected){t.next=2;break}return t.abrupt("return");case 2:return e=[],this.pending.forEach((function(t){e.push(t)})),t.next=6,this.batchSubscribe(e);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"registerEventListeners",value:function(){var t=this;this.relayer.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){return W(t,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.checkPending();case 2:case"end":return t.stop()}}),t,this)})))})),this.events.on(Le,(function(e){return W(t,null,T().mark((function t(){var n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Le,this.logger.info("Emitting ".concat(n)),this.logger.debug({type:"event",event:n,data:e}),t.next=5,this.persist();case 5:case"end":return t.stop()}}),t,this)})))})),this.events.on(Se,(function(e){return W(t,null,T().mark((function t(){var n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Se,this.logger.info("Emitting ".concat(n)),this.logger.debug({type:"event",event:n,data:e}),t.next=5,this.persist();case 5:case"end":return t.stop()}}),t,this)})))}))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}},{key:"restartToComplete",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.restartInProgress,!t.t0){t.next=4;break}return t.next=4,new Promise((function(t){var n=setInterval((function(){e.restartInProgress||(clearInterval(n),t())}),e.pollingInterval)}));case 4:case"end":return t.stop()}}),t,this)})))}}])}(u.k),rn=Object.defineProperty,on=Object.getOwnPropertySymbols,an=Object.prototype.hasOwnProperty,sn=Object.prototype.propertyIsEnumerable,un=function(t,e,n){return e in t?rn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},cn=function(t,e){for(var n in e||(e={}))an.call(e,n)&&un(t,n,e[n]);if(on){var r,i=O(on(e));try{for(i.s();!(r=i.n()).done;)n=r.value,sn.call(e,n)&&un(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},ln=function(t){function e(t){var n;return S(this,e),(n=A(this,e,[t])).protocol="wc",n.version=2,n.events=new r.EventEmitter,n.name="relayer",n.transportExplicitlyClosed=!1,n.initialized=!1,n.connectionAttemptInProgress=!1,n.connectionStatusPollingInterval=20,n.staleConnectionErrors=["socket hang up","socket stalled","interrupted"],n.hasExperiencedNetworkDisruption=!1,n.requestsInFlight=new Map,n.heartBeatTimeout=Object(f.toMiliseconds)(f.THIRTY_SECONDS+f.ONE_SECOND),n.request=function(t){return W(N(n),null,T().mark((function e(){var n,r,i,o,a,s=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.debug("Publishing Request Payload"),i=t.id||Object(y.getBigIntRpcId)().toString(),e.next=4,this.toEstablishConnection();case 4:return e.prev=4,o=this.provider.request(t),this.requestsInFlight.set(i,{promise:o,request:t}),this.logger.trace({id:i,method:t.method,topic:null==(n=t.params)?void 0:n.topic},"relayer.request - attempt to publish..."),e.next=9,new Promise((function(t,e){return W(s,null,T().mark((function n(){var r,a;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function(){e(new Error("relayer.request - publish interrupted, id: ".concat(i)))},this.provider.on(xe,r),n.next=4,o;case 4:a=n.sent,this.provider.off(xe,r),t(a);case 6:case"end":return n.stop()}}),n,this)})))}));case 9:return a=e.sent,e.abrupt("return",(this.logger.trace({id:i,method:t.method,topic:null==(r=t.params)?void 0:r.topic},"relayer.request - published"),a));case 13:throw e.prev=13,e.t0=e.catch(4),this.logger.debug("Failed to Publish Request: ".concat(i)),e.t0;case 16:return e.prev=16,this.requestsInFlight.delete(i),e.finish(16);case 19:case"end":return e.stop()}}),e,this,[[4,13,16,19]])})))},n.resetPingTimeout=function(){if(Object(h.N)())try{clearTimeout(n.pingTimeout),n.pingTimeout=setTimeout((function(){var t,e,r;null==(r=null==(e=null==(t=n.provider)?void 0:t.connection)?void 0:e.socket)||r.terminate()}),n.heartBeatTimeout)}catch(t){n.logger.warn(t)}},n.onPayloadHandler=function(t){n.onProviderPayload(t),n.resetPingTimeout()},n.onConnectHandler=function(){n.startPingTimeout(),n.events.emit(Ne.connect)},n.onDisconnectHandler=function(){n.onProviderDisconnect()},n.onProviderErrorHandler=function(t){n.logger.error(t),n.events.emit(Ne.error,t),n.logger.info("Fatal socket error received, closing transport"),n.transportClose()},n.registerProviderListeners=function(){n.provider.on(Ie,n.onPayloadHandler),n.provider.on(Ee,n.onConnectHandler),n.provider.on(xe,n.onDisconnectHandler),n.provider.on(ke,n.onProviderErrorHandler)},n.core=t.core,n.logger=k(t.logger)<"u"&&"string"!=typeof t.logger?Object(s.a)(t.logger,n.name):Object(s.e)(Object(s.c)({level:t.logger||"error"})),n.messages=new Fe(n.logger,t.core),n.subscriber=new nn(N(n),n.logger),n.publisher=new Ve(N(n),n.logger),n.relayUrl=(null==t?void 0:t.relayUrl)||Me,n.projectId=t.projectId,n.bundleId=Object(h.w)(),n.provider={},n}return E(e,t),C(e,[{key:"init",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.logger.trace("Initialized"),this.registerEventListeners(),t.next=4,this.createProvider();case 4:return t.next=6,Promise.all([this.messages.init(),this.subscriber.init()]);case 6:return t.prev=6,t.next=9,this.transportOpen();case 9:t.next=16;break;case 11:return t.prev=11,t.t0=t.catch(6),this.logger.warn("Connection via ".concat(this.relayUrl," failed, attempting to connect via failover domain ").concat(Ae,"...")),t.next=16,this.restartTransport(Ae);case 16:this.initialized=!0,setTimeout((function(){return W(e,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=0===this.subscriber.topics.length&&0===this.subscriber.pending.size,!t.t0){t.next=6;break}return this.logger.info("No topics subscribed to after init, closing transport"),t.next=5,this.transportClose();case 5:this.transportExplicitlyClosed=!1;case 6:case"end":return t.stop()}}),t,this)})))}),1e4);case 17:case"end":return t.stop()}}),t,this,[[6,11]])})))}},{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"connected",get:function(){var t,e,n;return 1===(null==(n=null==(e=null==(t=this.provider)?void 0:t.connection)?void 0:e.socket)?void 0:n.readyState)}},{key:"connecting",get:function(){var t,e,n;return 0===(null==(n=null==(e=null==(t=this.provider)?void 0:t.connection)?void 0:e.socket)?void 0:n.readyState)}},{key:"publish",value:function(t,e,n){return W(this,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.isInitialized(),r.next=3,this.publisher.publish(t,e,n);case 3:return r.next=5,this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now()});case 5:case"end":return r.stop()}}),r,this)})))}},{key:"subscribe",value:function(t,e){return W(this,null,T().mark((function n(){var r,i,o,a,s=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),i=(null==(r=this.subscriber.topicMap.get(t))?void 0:r[0])||"",a=function e(n){n.topic===t&&(s.subscriber.off(Le,e),o())},n.next=5,Promise.all([new Promise((function(t){o=t,s.subscriber.on(Le,a)})),new Promise((function(n){return W(s,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.subscriber.subscribe(t,e);case 2:if(r.t0=r.sent,r.t0){r.next=5;break}r.t0=i;case 5:i=r.t0,n();case 7:case"end":return r.stop()}}),r,this)})))}))]);case 5:return n.abrupt("return",i);case 6:case"end":return n.stop()}}),n,this)})))}},{key:"unsubscribe",value:function(t,e){return W(this,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),n.next=3,this.subscriber.unsubscribe(t,e);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"on",value:function(t,e){this.events.on(t,e)}},{key:"once",value:function(t,e){this.events.once(t,e)}},{key:"off",value:function(t,e){this.events.off(t,e)}},{key:"removeListener",value:function(t,e){this.events.removeListener(t,e)}},{key:"transportDisconnect",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)){t.next=9;break}return t.prev=1,t.next=4,Promise.all(Array.from(this.requestsInFlight.values()).map((function(t){return t.promise})));case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),this.logger.warn(t.t0);case 9:if(!this.hasExperiencedNetworkDisruption&&!this.connected){t.next=14;break}return t.next=12,Object(h.h)(this.provider.disconnect(),2e3,"provider.disconnect()").catch((function(){return e.onProviderDisconnect()}));case 12:t.next=15;break;case 14:this.onProviderDisconnect();case 15:case"end":return t.stop()}}),t,this,[[1,6]])})))}},{key:"transportClose",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.transportExplicitlyClosed=!0,t.next=3,this.transportDisconnect();case 3:case"end":return t.stop()}}),t,this)})))}},{key:"transportOpen",value:function(t){return W(this,null,T().mark((function e(){var n,r=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.confirmOnlineStateOrThrow();case 2:if(e.t0=t&&t!==this.relayUrl,!e.t0){e.next=9;break}return this.relayUrl=t,e.next=7,this.transportDisconnect();case 7:return e.next=9,this.createProvider();case 9:return this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1,e.prev=11,e.next=14,new Promise((function(t,e){return W(r,null,T().mark((function n(){var r,i=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function t(){i.provider.off(xe,t),e(new Error("Connection interrupted while trying to subscribe"))},this.provider.on(xe,r),n.next=4,Object(h.h)(this.provider.connect(),Object(f.toMiliseconds)(f.ONE_MINUTE),"Socket stalled when trying to connect to ".concat(this.relayUrl)).catch((function(t){e(t)}));case 4:return n.next=6,this.subscriber.start();case 6:this.hasExperiencedNetworkDisruption=!1,t();case 8:case"end":return n.stop()}}),n,this)})))}));case 14:e.next=22;break;case 16:if(e.prev=16,e.t1=e.catch(11),this.logger.error(e.t1),n=e.t1,this.isConnectionStalled(n.message)){e.next=22;break}throw e.t1;case 22:return e.prev=22,this.connectionAttemptInProgress=!1,e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[11,16,22,25]])})))}},{key:"restartTransport",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.connectionAttemptInProgress,e.t0){e.next=11;break}return this.relayUrl=t||this.relayUrl,e.next=5,this.confirmOnlineStateOrThrow();case 5:return e.next=7,this.transportClose();case 7:return e.next=9,this.createProvider();case 9:return e.next=11,this.transportOpen();case 11:case"end":return e.stop()}}),e,this)})))}},{key:"confirmOnlineStateOrThrow",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(h.O)();case 2:if(t.sent){t.next=4;break}throw new Error("No internet connection detected. Please restart your network and try again.");case 4:case"end":return t.stop()}}),t)})))}},{key:"startPingTimeout",value:function(){var t,e,n,r,i,o=this;if(Object(h.N)())try{null!=(e=null==(t=this.provider)?void 0:t.connection)&&e.socket&&(null==(i=null==(r=null==(n=this.provider)?void 0:n.connection)?void 0:r.socket)||i.once("ping",(function(){o.resetPingTimeout()}))),this.resetPingTimeout()}catch(t){this.logger.warn(t)}}},{key:"isConnectionStalled",value:function(t){return this.staleConnectionErrors.some((function(e){return t.includes(e)}))}},{key:"createProvider",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.provider.connection&&this.unregisterProviderListeners(),t.next=3,this.core.crypto.signJWT(this.relayUrl);case 3:e=t.sent,this.provider=new p.a(new m.a(Object(h.q)({sdkVersion:"2.12.2",protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners();case 5:case"end":return t.stop()}}),t,this)})))}},{key:"recordMessageEvent",value:function(t){return W(this,null,T().mark((function e(){var n,r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,r=t.message,e.next=3,this.messages.set(n,r);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"shouldIgnoreMessageEvent",value:function(t){return W(this,null,T().mark((function e(){var n,r,i;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.topic,(r=t.message)&&0!==r.length){e.next=3;break}return e.abrupt("return",(this.logger.debug("Ignoring invalid/empty message: ".concat(r)),!0));case 3:return e.next=5,this.subscriber.isSubscribed(n);case 5:if(e.sent){e.next=7;break}return e.abrupt("return",(this.logger.debug("Ignoring message for non-subscribed topic ".concat(n)),!0));case 7:return i=this.messages.has(n,r),e.abrupt("return",(i&&this.logger.debug("Ignoring duplicate message: ".concat(r)),i));case 9:case"end":return e.stop()}}),e,this)})))}},{key:"onProviderPayload",value:function(t){return W(this,null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),!Object(y.isJsonRpcRequest)(t)){e.next=13;break}if(t.method.endsWith("_subscription")){e.next=3;break}return e.abrupt("return");case 3:return n=t.params,r=n.data,i=r.topic,o=r.message,a=r.publishedAt,s={topic:i,message:o,publishedAt:a},this.logger.debug("Emitting Relayer Payload"),this.logger.trace(cn({type:"event",event:n.id},s)),this.events.emit(n.id,s),e.next=9,this.acknowledgePayload(t);case 9:return e.next=11,this.onMessageEvent(s);case 11:e.next=14;break;case 13:Object(y.isJsonRpcResponse)(t)&&this.events.emit(Ne.message_ack,t);case 14:case"end":return e.stop()}}),e,this)})))}},{key:"onMessageEvent",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.shouldIgnoreMessageEvent(t);case 2:if(e.t0=e.sent,e.t0){e.next=7;break}return this.events.emit(Ne.message,t),e.next=7,this.recordMessageEvent(t);case 7:case"end":return e.stop()}}),e,this)})))}},{key:"acknowledgePayload",value:function(t){return W(this,null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(y.formatJsonRpcResult)(t.id,!0),e.next=3,this.provider.connection.send(n);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"unregisterProviderListeners",value:function(){this.provider.off(Ie,this.onPayloadHandler),this.provider.off(Ee,this.onConnectHandler),this.provider.off(xe,this.onDisconnectHandler),this.provider.off(ke,this.onProviderErrorHandler)}},{key:"registerEventListeners",value:function(){return W(this,null,T().mark((function t(){var e,n=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(h.O)();case 2:e=t.sent,Object(h.ub)((function(t){return W(n,null,T().mark((function n(){var r=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.t0=e!==t,!n.t0){n.next=12;break}if(e=t,!t){n.next=8;break}return n.next=6,this.restartTransport().catch((function(t){return r.logger.error(t)}));case 6:n.next=12;break;case 8:return this.hasExperiencedNetworkDisruption=!0,n.next=11,this.transportDisconnect();case 11:this.transportExplicitlyClosed=!1;case 12:case"end":return n.stop()}}),n,this)})))}));case 4:case"end":return t.stop()}}),t)})))}},{key:"onProviderDisconnect",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.subscriber.stop();case 2:this.events.emit(Ne.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout((function(){return W(e,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.transportOpen().catch((function(t){return e.logger.error(t)}));case 2:case"end":return t.stop()}}),t,this)})))}),Object(f.toMiliseconds)(Te));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}},{key:"toEstablishConnection",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.confirmOnlineStateOrThrow();case 2:if(t.t0=!this.connected,!t.t0){t.next=10;break}if(t.t1=this.connectionAttemptInProgress,!t.t1){t.next=8;break}return t.next=8,new Promise((function(t){var n=setInterval((function(){e.connected&&(clearInterval(n),t())}),e.connectionStatusPollingInterval)}));case 8:return t.next=10,this.transportOpen();case 10:case"end":return t.stop()}}),t,this)})))}}])}(u.h),hn=Object.defineProperty,dn=Object.getOwnPropertySymbols,fn=Object.prototype.hasOwnProperty,pn=Object.prototype.propertyIsEnumerable,yn=function(t,e,n){return e in t?hn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},mn=function(t,e){for(var n in e||(e={}))fn.call(e,n)&&yn(t,n,e[n]);if(dn){var r,i=O(dn(e));try{for(i.s();!(r=i.n()).done;)n=r.value,pn.call(e,n)&&yn(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},gn=function(t){function e(t,n,r){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ye,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;return S(this,e),(i=A(this,e,[t,n,r,o])).core=t,i.logger=n,i.name=r,i.map=new Map,i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=ye,i.recentlyDeleted=[],i.recentlyDeletedLimit=200,i.init=function(){return W(N(i),null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=8;break}return this.logger.trace("Initialized"),t.next=5,this.restore();case 5:this.cached.forEach((function(t){e.getKey&&null!==t&&!Object(h.U)(t)?e.map.set(e.getKey(t),t):Object(h.P)(t)?e.map.set(t.id,t):Object(h.S)(t)&&e.map.set(t.topic,t)})),this.cached=[],this.initialized=!0;case 8:case"end":return t.stop()}}),t,this)})))},i.set=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),!this.map.has(t)){n.next=6;break}return n.next=4,this.update(t,e);case 4:n.next=11;break;case 6:return this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:t,value:e}),this.map.set(t,e),n.next=11,this.persist();case 11:case"end":return n.stop()}}),n,this)})))},i.get=function(t){return i.isInitialized(),i.logger.debug("Getting value"),i.logger.trace({type:"method",method:"get",key:t}),i.getData(t)},i.getAll=function(t){return i.isInitialized(),t?i.values.filter((function(e){return Object.keys(t).every((function(n){return v()(e[n],t[n])}))})):i.values},i.update=function(t,e){return W(N(i),null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:t,update:e}),r=mn(mn({},this.getData(t)),e),this.map.set(t,r),n.next=5,this.persist();case 5:case"end":return n.stop()}}),n,this)})))},i.delete=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),n.t0=this.map.has(t),!n.t0){n.next=9;break}return this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:t,reason:e}),this.map.delete(t),this.addToRecentlyDeleted(t),n.next=9,this.persist();case 9:case"end":return n.stop()}}),n,this)})))},i.logger=Object(s.a)(n,i.name),i.storagePrefix=o,i.getKey=a,i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.map.size}},{key:"keys",get:function(){return Array.from(this.map.keys())}},{key:"values",get:function(){return Array.from(this.map.values())}},{key:"addToRecentlyDeleted",value:function(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}},{key:"setDataStore",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getDataStore",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getData",value:function(t){var e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){var n=Object(h.A)("MISSING_OR_INVALID","Record was recently deleted - ".concat(this.name,": ").concat(t)).message;throw this.logger.error(n),new Error(n)}var r=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw this.logger.error(r),new Error(r)}return e}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setDataStore(this.values);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getDataStore();case 3:if(!(k(e=t.sent)>"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.map.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored value for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",value:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore value for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.j),vn=C((function t(e,n){var r=this;S(this,t),this.core=e,this.logger=n,this.name="pairing",this.version="0.3",this.events=new i.a,this.initialized=!1,this.storagePrefix=ye,this.ignoredPayloadTypes=[h.c],this.registeredMethods=[],this.init=function(){return W(r,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=10;break}return t.next=4,this.pairings.init();case 4:return t.next=6,this.cleanup();case 6:this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized");case 10:case"end":return t.stop()}}),t,this)})))},this.register=function(t){var e=t.methods;r.isInitialized(),r.registeredMethods=M(new Set([].concat(M(r.registeredMethods),M(e))))},this.create=function(t){return W(r,null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),n=Object(h.u)(),e.next=4,this.core.crypto.setSymKey(n);case 4:return r=e.sent,i=Object(h.e)(f.FIVE_MINUTES),a={topic:r,expiry:i,relay:o={protocol:be},active:!1},s=Object(h.s)({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:n,relay:o,expiryTimestamp:i,methods:null==t?void 0:t.methods}),e.next=11,this.pairings.set(r,a);case 11:return e.next=13,this.core.relayer.subscribe(r);case 13:return this.core.expirer.set(r,i),e.abrupt("return",{topic:r,uri:s});case 15:case"end":return e.stop()}}),e,this)})))},this.pair=function(t){return W(r,null,T().mark((function e(){var n,r,i,o,a,s,u,c;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isInitialized(),this.isValidPair(t),n=Object(h.tb)(t.uri),r=n.topic,i=n.symKey,o=n.relay,a=n.expiryTimestamp,s=n.methods,!this.pairings.keys.includes(r)||!this.pairings.get(r).active){e.next=4;break}throw new Error("Pairing already exists: ".concat(r,". Please try again with a new connection URI."));case 4:return u=a||Object(h.e)(f.FIVE_MINUTES),c={topic:r,relay:o,expiry:u,active:!1,methods:s},e.next=7,this.pairings.set(r,c);case 7:if(this.core.expirer.set(r,u),e.t0=t.activatePairing,!e.t0){e.next=12;break}return e.next=12,this.activate({topic:r});case 12:if(this.events.emit(De.create,c),e.t1=this.core.crypto.keychain.has(r),e.t1){e.next=17;break}return e.next=17,this.core.crypto.setSymKey(i,r);case 17:return e.next=19,this.core.relayer.subscribe(r,{relay:o});case 19:return e.abrupt("return",c);case 20:case"end":return e.stop()}}),e,this)})))},this.activate=function(t){return W(r,[t],(function(t){var e=this,n=t.topic;return T().mark((function t(){var r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isInitialized(),r=Object(h.e)(f.THIRTY_DAYS),t.next=4,e.pairings.update(n,{active:!0,expiry:r});case 4:e.core.expirer.set(n,r);case 5:case"end":return t.stop()}}),t)}))()}))},this.ping=function(t){return W(r,null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.isValidPing(t);case 3:if(n=t.topic,!this.pairings.keys.includes(n)){e.next=15;break}return e.next=7,this.sendRequest(n,"wc_pairingPing",{});case 7:return r=e.sent,i=Object(h.f)(),o=i.done,a=i.resolve,s=i.reject,this.events.once(Object(h.n)("pairing_ping",r),(function(t){var e=t.error;e?s(e):a()})),e.next=15,o();case 15:case"end":return e.stop()}}),e,this)})))},this.updateExpiry=function(t){return W(r,[t],(function(t){var e=this,n=t.topic,r=t.expiry;return T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isInitialized(),t.next=3,e.pairings.update(n,{expiry:r});case 3:case"end":return t.stop()}}),t)}))()}))},this.updateMetadata=function(t){return W(r,[t],(function(t){var e=this,n=t.topic,r=t.metadata;return T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isInitialized(),t.next=3,e.pairings.update(n,{peerMetadata:r});case 3:case"end":return t.stop()}}),t)}))()}))},this.getPairings=function(){return r.isInitialized(),r.pairings.values},this.disconnect=function(t){return W(r,null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.isValidDisconnect(t);case 3:if(n=t.topic,e.t0=this.pairings.keys.includes(n),!e.t0){e.next=10;break}return e.next=8,this.sendRequest(n,"wc_pairingDelete",Object(h.G)("USER_DISCONNECTED"));case 8:return e.next=10,this.deletePairing(n);case 10:case"end":return e.stop()}}),e,this)})))},this.sendRequest=function(t,e,n){return W(r,null,T().mark((function r(){var i,o,a;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcRequest)(e,n),r.next=3,this.core.crypto.encode(t,i);case 3:return o=r.sent,a=Ce[e].req,r.abrupt("return",(this.core.history.set(t,i),this.core.relayer.publish(t,o,a),i.id));case 6:case"end":return r.stop()}}),r,this)})))},this.sendResult=function(t,e,n){return W(r,null,T().mark((function r(){var i,o,a,s;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcResult)(t,n),r.next=3,this.core.crypto.encode(e,i);case 3:return o=r.sent,r.next=6,this.core.history.get(e,t);case 6:return a=r.sent,s=Ce[a.request.method].res,r.next=10,this.core.relayer.publish(e,o,s);case 10:return r.next=12,this.core.history.resolve(i);case 12:case"end":return r.stop()}}),r,this)})))},this.sendError=function(t,e,n){return W(r,null,T().mark((function r(){var i,o,a,s;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcError)(t,n),r.next=3,this.core.crypto.encode(e,i);case 3:return o=r.sent,r.next=6,this.core.history.get(e,t);case 6:return a=r.sent,s=Ce[a.request.method]?Ce[a.request.method].res:Ce.unregistered_method.res,r.next=10,this.core.relayer.publish(e,o,s);case 10:return r.next=12,this.core.history.resolve(i);case 12:case"end":return r.stop()}}),r,this)})))},this.deletePairing=function(t,e){return W(r,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.core.relayer.unsubscribe(t);case 2:return n.next=4,Promise.all([this.pairings.delete(t,Object(h.G)("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(t),e?Promise.resolve():this.core.expirer.del(t)]);case 4:case"end":return n.stop()}}),n,this)})))},this.cleanup=function(){return W(r,null,T().mark((function t(){var e,n=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.pairings.getAll().filter((function(t){return Object(h.M)(t.expiry)})),t.next=3,Promise.all(e.map((function(t){return n.deletePairing(t.topic)})));case 3:case"end":return t.stop()}}),t,this)})))},this.onRelayEventRequest=function(t){var e=t.topic,n=t.payload;switch(n.method){case"wc_pairingPing":return r.onPairingPingRequest(e,n);case"wc_pairingDelete":return r.onPairingDeleteRequest(e,n);default:return r.onUnknownRpcMethodRequest(e,n)}},this.onRelayEventResponse=function(t){return W(r,null,T().mark((function e(){var n,r,i;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,r=t.payload,e.next=4,this.core.history.get(n,r.id);case 4:i=e.sent.request.method,e.t0=i,e.next="wc_pairingPing"===e.t0?8:9;break;case 8:return e.abrupt("return",this.onPairingPingResponse(n,r));case 9:return e.abrupt("return",this.onUnknownRpcMethodResponse(i));case 10:case"end":return e.stop()}}),e,this)})))},this.onPairingPingRequest=function(t,e){return W(r,null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.id,n.prev=1,this.isValidPing({topic:t}),n.next=5,this.sendResult(r,t,!0);case 5:this.events.emit(De.ping,{id:r,topic:t}),n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(1),n.next=12,this.sendError(r,t,n.t0);case 12:this.logger.error(n.t0);case 13:case"end":return n.stop()}}),n,this,[[1,8]])})))},this.onPairingPingResponse=function(t,e){var n=e.id;setTimeout((function(){Object(y.isJsonRpcResult)(e)?r.events.emit(Object(h.n)("pairing_ping",n),{}):Object(y.isJsonRpcError)(e)&&r.events.emit(Object(h.n)("pairing_ping",n),{error:e.error})}),500)},this.onPairingDeleteRequest=function(t,e){return W(r,null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.id,n.prev=1,this.isValidDisconnect({topic:t}),n.next=5,this.deletePairing(t);case 5:this.events.emit(De.delete,{id:r,topic:t}),n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(1),n.next=12,this.sendError(r,t,n.t0);case 12:this.logger.error(n.t0);case 13:case"end":return n.stop()}}),n,this,[[1,8]])})))},this.onUnknownRpcMethodRequest=function(t,e){return W(r,null,T().mark((function n(){var r,i,o;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=e.id,i=e.method,n.prev=1,!this.registeredMethods.includes(i)){n.next=4;break}return n.abrupt("return");case 4:return o=Object(h.G)("WC_METHOD_UNSUPPORTED",i),n.next=7,this.sendError(r,t,o);case 7:this.logger.error(o),n.next=15;break;case 10:return n.prev=10,n.t0=n.catch(1),n.next=14,this.sendError(r,t,n.t0);case 14:this.logger.error(n.t0);case 15:case"end":return n.stop()}}),n,this,[[1,10]])})))},this.onUnknownRpcMethodResponse=function(t){r.registeredMethods.includes(t)||r.logger.error(Object(h.G)("WC_METHOD_UNSUPPORTED",t))},this.isValidPair=function(t){var e;if(!Object(h.fb)(t)){var n=Object(h.A)("MISSING_OR_INVALID","pair() params: ".concat(t)).message;throw new Error(n)}if(!Object(h.nb)(t.uri)){var r=Object(h.A)("MISSING_OR_INVALID","pair() uri: ".concat(t.uri)).message;throw new Error(r)}var i=Object(h.tb)(t.uri);if(null==(e=null==i?void 0:i.relay)||!e.protocol){var o=Object(h.A)("MISSING_OR_INVALID","pair() uri#relay-protocol").message;throw new Error(o)}if(null==i||!i.symKey){var a=Object(h.A)("MISSING_OR_INVALID","pair() uri#symKey").message;throw new Error(a)}if(null!=i&&i.expiryTimestamp&&Object(f.toMiliseconds)(null==i?void 0:i.expiryTimestamp)"u"&&(n.response=Object(y.isJsonRpcError)(t)?{error:t.error}:{result:t.result},this.records.set(n.id,n),this.persist(),this.events.emit(ze,n));case 6:case"end":return e.stop()}}),e,this)})))},i.get=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:t,id:e}),n.next=5,this.getRecord(e);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n,this)})))},i.delete=function(t,e){i.isInitialized(),i.logger.debug("Deleting record"),i.logger.trace({type:"method",method:"delete",id:e}),i.values.forEach((function(n){if(n.topic===t){if(k(e)<"u"&&n.id!==e)return;i.records.delete(n.id),i.events.emit(Pe,n)}})),i.persist()},i.exists=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),!this.records.has(e)){n.next=9;break}return n.next=4,this.getRecord(e);case 4:n.t1=n.sent.topic,n.t2=t,n.t0=n.t1===n.t2,n.next=10;break;case 9:n.t0=!1;case 10:return n.abrupt("return",n.t0);case 11:case"end":return n.stop()}}),n,this)})))},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.logger=Object(s.a)(n,i.name),i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"size",get:function(){return this.records.size}},{key:"keys",get:function(){return Array.from(this.records.keys())}},{key:"values",get:function(){return Array.from(this.records.values())}},{key:"pending",get:function(){var t=[];return this.values.forEach((function(e){if(!(k(e.response)<"u")){var n={topic:e.topic,request:Object(y.formatJsonRpcRequest)(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(n)}})),t}},{key:"setJsonRpcRecords",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getJsonRpcRecords",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getRecord",value:function(t){this.isInitialized();var e=this.records.get(t);if(!e){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw new Error(n)}return e}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setJsonRpcRecords(this.values);case 2:this.events.emit("history_sync");case 3:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getJsonRpcRecords();case 3:if(!(k(e=t.sent)>"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.records.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",records:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"registerEventListeners",value:function(){var t=this;this.events.on(Oe,(function(e){var n=Oe;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,record:e})})),this.events.on(ze,(function(e){var n=ze;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,record:e})})),this.events.on(Pe,(function(e){var n=Pe;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,record:e})})),this.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){t.cleanup()}))}},{key:"cleanup",value:function(){var t=this;try{this.isInitialized();var e=!1;this.records.forEach((function(n){Object(f.toMiliseconds)(n.expiry||0)-Date.now()<=0&&(t.logger.info("Deleting expired history log: ".concat(n.id)),t.records.delete(n.id),t.events.emit(Pe,n,!1),e=!0)})),e&&this.persist()}catch(e){this.logger.warn(e)}}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.e),bn=function(t){function e(t,n){var i;return S(this,e),(i=A(this,e,[t,n])).core=t,i.logger=n,i.expirations=new Map,i.events=new r.EventEmitter,i.name="expirer",i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=ye,i.init=function(){return W(N(i),null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=9;break}return this.logger.trace("Initialized"),t.next=5,this.restore();case 5:this.cached.forEach((function(t){return e.expirations.set(t.target,t)})),this.cached=[],this.registerEventListeners(),this.initialized=!0;case 9:case"end":return t.stop()}}),t,this)})))},i.has=function(t){try{var e=i.formatTarget(t);return k(i.getExpiration(e))<"u"}catch(t){return!1}},i.set=function(t,e){i.isInitialized();var n=i.formatTarget(t),r={target:n,expiry:e};i.expirations.set(n,r),i.checkExpiry(n,r),i.events.emit(_e.created,{target:n,expiration:r})},i.get=function(t){i.isInitialized();var e=i.formatTarget(t);return i.getExpiration(e)},i.del=function(t){if(i.isInitialized(),i.has(t)){var e=i.formatTarget(t),n=i.getExpiration(e);i.expirations.delete(e),i.events.emit(_e.deleted,{target:e,expiration:n})}},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.logger=Object(s.a)(n,i.name),i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.expirations.size}},{key:"keys",get:function(){return Array.from(this.expirations.keys())}},{key:"values",get:function(){return Array.from(this.expirations.values())}},{key:"formatTarget",value:function(t){if("string"==typeof t)return Object(h.r)(t);if("number"==typeof t)return Object(h.o)(t);var e=Object(h.A)("UNKNOWN_TYPE","Target type: ".concat(k(t))).message;throw new Error(e)}},{key:"setExpirations",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getExpirations",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setExpirations(this.values);case 2:this.events.emit(_e.sync);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getExpirations();case 3:if(!(k(e=t.sent)>"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.expirations.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored expirations for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",expirations:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore expirations for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"getExpiration",value:function(t){var e=this.expirations.get(t);if(!e){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw this.logger.warn(n),new Error(n)}return e}},{key:"checkExpiry",value:function(t,e){var n=e.expiry;Object(f.toMiliseconds)(n)-Date.now()<=0&&this.expire(t,e)}},{key:"expire",value:function(t,e){this.expirations.delete(t),this.events.emit(_e.expired,{target:t,expiration:e})}},{key:"checkExpirations",value:function(){var t=this;this.core.relayer.connected&&this.expirations.forEach((function(e,n){return t.checkExpiry(n,e)}))}},{key:"registerEventListeners",value:function(){var t=this;this.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){return t.checkExpirations()})),this.events.on(_e.created,(function(e){var n=_e.created;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,data:e}),t.persist()})),this.events.on(_e.expired,(function(e){var n=_e.expired;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,data:e}),t.persist()})),this.events.on(_e.deleted,(function(e){var n=_e.deleted;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,data:e}),t.persist()}))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.d),Mn=function(e){function n(e,r){var i;return S(this,n),(i=A(this,n,[e,r])).projectId=e,i.logger=r,i.name=Be,i.initialized=!1,i.queue=[],i.verifyDisabled=!1,i.init=function(t){return W(N(i),null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.verifyDisabled&&!Object(h.Q)()&&Object(h.K)()){e.next=2;break}return e.abrupt("return");case 2:return n=this.getVerifyUrl(null==t?void 0:t.verifyUrl),this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n,e.prev=4,e.next=7,this.createIframe();case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(4),this.logger.info("Verify iframe failed to load: ".concat(this.verifyUrl)),this.logger.info(e.t0);case 12:if(this.initialized){e.next=22;break}return this.removeIframe(),this.verifyUrl=Ue,e.prev=14,e.next=17,this.createIframe();case 17:e.next=22;break;case 19:e.prev=19,e.t1=e.catch(14),this.logger.info("Verify iframe failed to load: ".concat(this.verifyUrl)),this.logger.info(e.t1),this.verifyDisabled=!0;case 22:case"end":return e.stop()}}),e,this,[[4,9],[14,19]])})))},i.register=function(t){return W(N(i),null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.initialized){e.next=4;break}this.sendPost(t.attestationId),e.next=7;break;case 4:return this.addToQueue(t.attestationId),e.next=7,this.init();case 7:case"end":return e.stop()}}),e,this)})))},i.resolve=function(t){return W(N(i),null,T().mark((function e(){var n,r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isDevEnv){e.next=2;break}return e.abrupt("return","");case 2:return n=this.getVerifyUrl(null==t?void 0:t.verifyUrl),e.prev=3,e.next=6,this.fetchAttestation(t.attestationId,n);case 6:r=e.sent,e.next=16;break;case 9:return e.prev=9,e.t0=e.catch(3),this.logger.info("failed to resolve attestation: ".concat(t.attestationId," from url: ").concat(n)),this.logger.info(e.t0),e.next=15,this.fetchAttestation(t.attestationId,Ue);case 15:r=e.sent;case 16:return e.abrupt("return",r);case 17:case"end":return e.stop()}}),e,this,[[3,9]])})))},i.fetchAttestation=function(t,e){return W(N(i),null,T().mark((function n(){var r,i;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.logger.info("resolving attestation: ".concat(t," from url: ").concat(e)),r=this.startAbortTimer(2*f.ONE_SECOND),n.next=4,fetch("".concat(e,"/attestation/").concat(t),{signal:this.abortController.signal});case 4:if(i=n.sent,clearTimeout(r),200!==i.status){n.next=12;break}return n.next=9,i.json();case 9:n.t0=n.sent,n.next=13;break;case 12:n.t0=void 0;case 13:return n.abrupt("return",n.t0);case 14:case"end":return n.stop()}}),n,this)})))},i.addToQueue=function(t){i.queue.push(t)},i.processQueue=function(){0!==i.queue.length&&(i.queue.forEach((function(t){return i.sendPost(t)})),i.queue=[])},i.sendPost=function(t){var e;try{if(!i.iframe)return;null==(e=i.iframe.contentWindow)||e.postMessage(t,"*"),i.logger.info("postMessage sent: ".concat(t," ").concat(i.verifyUrl))}catch(t){}},i.createIframe=function(){return W(N(i),null,T().mark((function t(){var e,n,r=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=function t(n){"verify_ready"===n.data&&(r.onInit(),window.removeEventListener("message",t),e())},t.next=3,Promise.race([new Promise((function(t){var i=document.getElementById(Be);if(i)return r.iframe=i,r.onInit(),t();window.addEventListener("message",n);var o=document.createElement("iframe");o.id=Be,o.src="".concat(r.verifyUrl,"/").concat(r.projectId),o.style.display="none",document.body.append(o),r.iframe=o,e=t})),new Promise((function(t,e){return setTimeout((function(){window.removeEventListener("message",n),e("verify iframe load timeout")}),Object(f.toMiliseconds)(f.FIVE_SECONDS))}))]);case 3:case"end":return t.stop()}}),t)})))},i.onInit=function(){i.initialized=!0,i.processQueue()},i.removeIframe=function(){i.iframe&&(i.iframe.remove(),i.iframe=void 0,i.initialized=!1)},i.getVerifyUrl=function(t){var e=t||Re;return Qe.includes(e)||(i.logger.info("verify url: ".concat(e,", not included in trusted list, assigning default: ").concat(Re)),e=Re),e},i.logger=Object(s.a)(r,i.name),i.verifyUrl=Re,i.abortController=new AbortController,i.isDevEnv=Object(h.N)()&&t.env.IS_VITEST,i}return E(n,e),C(n,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"startAbortTimer",value:function(t){var e=this;return this.abortController=new AbortController,setTimeout((function(){return e.abortController.abort()}),Object(f.toMiliseconds)(t))}}])}(u.l),An=function(t){function e(t,n){var r;return S(this,e),(r=A(this,e,[t,n])).projectId=t,r.logger=n,r.context="echo",r.registerDeviceToken=function(t){return W(N(r),null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.clientId,r=t.token,i=t.notificationType,o=t.enableEncrypted,a=void 0!==o&&o,s="".concat("https://echo.walletconnect.com","/").concat(this.projectId,"/clients"),e.next=3,b()(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:i,token:r,always_raw:a})});case 3:case"end":return e.stop()}}),e,this)})))},r.logger=Object(s.a)(n,r.context),r}return E(e,t),C(e)}(u.b),Nn=Object.defineProperty,In=Object.getOwnPropertySymbols,En=Object.prototype.hasOwnProperty,xn=Object.prototype.propertyIsEnumerable,kn=function(t,e,n){return e in t?Nn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},Tn=function(t,e){for(var n in e||(e={}))En.call(e,n)&&kn(t,n,e[n]);if(In){var r,i=O(In(e));try{for(i.s();!(r=i.n()).done;)n=r.value,xn.call(e,n)&&kn(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},Ln=function(t){function e(t){var n,i;S(this,e),(n=A(this,e,[t])).protocol="wc",n.version=2,n.name=pe,n.events=new r.EventEmitter,n.initialized=!1,n.on=function(t,e){return n.events.on(t,e)},n.once=function(t,e){return n.events.once(t,e)},n.off=function(t,e){return n.events.off(t,e)},n.removeListener=function(t,e){return n.events.removeListener(t,e)},n.projectId=null==t?void 0:t.projectId,n.relayUrl=(null==t?void 0:t.relayUrl)||Me,n.customStoragePrefix=null!=t&&t.customStoragePrefix?":".concat(t.customStoragePrefix):"";var u=Object(s.c)({level:"string"==typeof(null==t?void 0:t.logger)&&t.logger?t.logger:"error"}),c=Object(s.b)({opts:u,maxSizeInBytes:null==t?void 0:t.maxLogBlobSizeInBytes,loggerOverride:null==t?void 0:t.logger}),l=c.logger,h=c.chunkLoggerController;return n.logChunkController=h,null!=(i=n.logChunkController)&&i.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=function(){return W(n,null,T().mark((function t(){var e,n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser,!t.t0){t.next=10;break}if(t.t1=null==(n=this.logChunkController),t.t1){t.next=10;break}return t.t2=n,t.next=7,this.crypto.getClientId();case 7:t.t3=t.sent,t.t4={clientId:t.t3},t.t2.downloadLogsBlobInBrowser.call(t.t2,t.t4);case 10:case"end":return t.stop()}}),t,this)})))}),n.logger=Object(s.a)(l,n.name),n.heartbeat=new a.HeartBeat,n.crypto=new We(n,n.logger,null==t?void 0:t.keychain),n.history=new wn(n,n.logger),n.expirer=new bn(n,n.logger),n.storage=null!=t&&t.storage?t.storage:new o.a(Tn(Tn({},me),null==t?void 0:t.storageOptions)),n.relayer=new ln({core:n,logger:n.logger,relayUrl:n.relayUrl,projectId:n.projectId}),n.pairing=new vn(n,n.logger),n.verify=new Mn(n.projectId||"",n.logger),n.echoClient=new An(n.projectId||"",n.logger),n}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"start",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=4;break}return t.next=4,this.initialize();case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getLogsBlob",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=(e=this.logChunkController)){t.next=4;break}t.t0=void 0,t.next=10;break;case 4:return t.t1=e,t.next=7,this.crypto.getClientId();case 7:t.t2=t.sent,t.t3={clientId:t.t2},t.t0=t.t1.logsToBlob.call(t.t1,t.t3);case 10:return t.abrupt("return",t.t0);case 11:case"end":return t.stop()}}),t,this)})))}},{key:"initialize",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.logger.trace("Initialized"),t.prev=1,t.next=4,this.crypto.init();case 4:return t.next=6,this.history.init();case 6:return t.next=8,this.expirer.init();case 8:return t.next=10,this.relayer.init();case 10:return t.next=12,this.heartbeat.init();case 12:return t.next=14,this.pairing.init();case 14:this.initialized=!0,this.logger.info("Core Initialization Success"),t.next=21;break;case 18:throw t.prev=18,t.t0=t.catch(1),this.logger.warn("Core Initialization Failure at epoch ".concat(Date.now()),t.t0),this.logger.error(t.t0.message),t.t0;case 21:case"end":return t.stop()}}),t,this,[[1,18]])})))}}],[{key:"init",value:function(t){return W(this,null,T().mark((function n(){var r,i;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=new e(t),n.next=3,r.initialize();case 3:return n.next=5,r.crypto.getClientId();case 5:return i=n.sent,n.next=8,r.storage.setItem("WALLETCONNECT_CLIENT_ID",i);case 8:return n.abrupt("return",r);case 9:case"end":return n.stop()}}),n)})))}}])}(u.a)}).call(this,n(33))},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string";if(!t[e]||r(t[e])!==n)throw new Error('Missing or invalid "'.concat(e,'" param'))}function o(t,e,n){return!!(n.length?function(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}(t,e.length):function(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}(t,e.length))&&function(t,e){var n=!0;return e.forEach((function(e){e in t||(n=!1)})),n}(t,e)}function a(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_",r=t.split(n);return r[r.length-1].trim().toLowerCase()===e.trim().toLowerCase()}n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return a}))},function(t,e,n){n.d(e,"a",(function(){return y})),n.d(e,"b",(function(){return I})),n.d(e,"c",(function(){return x})),n.d(e,"d",(function(){return A})),n.d(e,"e",(function(){return m})),n.d(e,"f",(function(){return g})),n.d(e,"g",(function(){return v})),n.d(e,"h",(function(){return w})),n.d(e,"i",(function(){return E})),n.d(e,"j",(function(){return b})),n.d(e,"k",(function(){return M})),n.d(e,"l",(function(){return N}));var r=n(22),i=n(6),o=n.n(i);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var n=0;ne in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,u=(t,e)=>{for(var n in e||(e={}))o.call(e,n)&&s(t,n,e[n]);if(i)for(var n of i(e))a.call(e,n)&&s(t,n,e[n]);return t};Object.defineProperty(e,"__esModule",{value:!0});var c=n(95),l=n(18);class h{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class d{constructor(t,e,n){if(this.name=t,this.prefix=e,void 0===e.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if("string"==typeof t){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(t){return p(this,t)}}class f{constructor(t){this.decoders=t}or(t){return p(this,t)}decode(t){const e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const p=(t,e)=>new f(u(u({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class y{constructor(t,e,n,r){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=r,this.encoder=new h(t,e,n),this.decoder=new d(t,e,r)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const m=({name:t,prefix:e,encode:n,decode:r})=>new y(t,e,n,r);e.Codec=y,e.baseX=({prefix:t,name:e,alphabet:n})=>{const{encode:r,decode:i}=c(n,e);return m({prefix:t,name:e,encode:r,decode:t=>l.coerce(i(t))})},e.from=m,e.or=p,e.rfc4648=({name:t,prefix:e,bitsPerChar:n,alphabet:r})=>m({prefix:e,name:t,encode:t=>((t,e,n)=>{const r="="===e[e.length-1],i=(1<n;)a-=n,o+=e[i&s>>a];if(a&&(o+=e[i&s<((t,e,n,r)=>{const i={};for(let t=0;t=8&&(s-=8,a[c++]=255&u>>s)}if(s>=n||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a})(e,r,n,t)})},function(t,e,n){const r=n(86);t.exports=a;const i=function(){function t(t){return void 0!==t&&t}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e){return t(self)||t(window)||t(this)||{}}}().console||{},o={mapHttpRequest:p,mapHttpResponse:p,wrapRequestSerializer:y,wrapResponseSerializer:y,wrapErrorSerializer:y,req:p,res:p,err:function(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)void 0===e[n]&&(e[n]=t[n]);return e}};function a(t){(t=t||{}).browser=t.browser||{};const e=t.browser.transmit;if(e&&"function"!=typeof e.send)throw Error("pino: transmit option must have a send function");const n=t.browser.write||i;t.browser.write&&(t.browser.asObject=!0);const r=t.serializers||{},o=function(t,e){return Array.isArray(t)?t.filter((function(t){return"!stdSerializers.err"!==t})):!0===t&&Object.keys(e)}(t.browser.serialize,r);let u=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(u=!1),"function"==typeof n&&(n.error=n.fatal=n.warn=n.info=n.debug=n.trace=n),!1===t.enabled&&(t.level="silent");const h=t.level||"info",p=Object.create(n);p.log||(p.log=m),Object.defineProperty(p,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(p,"level",{get:function(){return this._level},set:function(t){if("silent"!==t&&!this.levels.values[t])throw Error("unknown level "+t);this._level=t,s(y,p,"error","log"),s(y,p,"fatal","error"),s(y,p,"warn","error"),s(y,p,"info","log"),s(y,p,"debug","log"),s(y,p,"trace","log")}});const y={transmit:e,serialize:o,asObject:t.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:f(t)};return p.levels=a.levels,p.level=h,p.setMaxListeners=p.getMaxListeners=p.emit=p.addListener=p.on=p.prependListener=p.once=p.prependOnceListener=p.removeListener=p.removeAllListeners=p.listeners=p.listenerCount=p.eventNames=p.write=p.flush=m,p.serializers=r,p._serialize=o,p._stdErrSerialize=u,p.child=function(n,i){if(!n)throw new Error("missing bindings for child Pino");i=i||{},o&&n.serializers&&(i.serializers=n.serializers);const a=i.serializers;if(o&&a){var s=Object.assign({},r,a),u=!0===t.browser.serialize?Object.keys(s):o;delete n.serializers,c([n],u,s,this._stdErrSerialize)}function h(t){this._childLevel=1+(0|t._childLevel),this.error=l(t,n,"error"),this.fatal=l(t,n,"fatal"),this.warn=l(t,n,"warn"),this.info=l(t,n,"info"),this.debug=l(t,n,"debug"),this.trace=l(t,n,"trace"),s&&(this.serializers=s,this._serialize=u),e&&(this._logEvent=d([].concat(t._logEvent.bindings,n)))}return h.prototype=this,new h(this)},e&&(p._logEvent=d()),p}function s(t,e,n,r){const o=Object.getPrototypeOf(e);e[n]=e.levelVal>e.levels.values[n]?m:o[n]?o[n]:i[n]||i[r]||m,function(t,e,n){var r;(t.transmit||e[n]!==m)&&(e[n]=(r=e[n],function(){const o=t.timestamp(),s=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var d=0;d-1&&r in n&&(t[i][r]=n[r](t[i][r]))}function l(t,e,n){return function(){const r=new Array(1+arguments.length);r[0]=e;for(var i=1;ia,d=l>a;if(h&&(c=e-c),d&&(l=e-l),c>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:h,k1:c,k2neg:d,k2:l}}}},Os=wr,zs=function(t){return Es(D(D({},Ds),function(t){return{hash:t,hmac:function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i$s)throw new Error("Invalid public key input")}return e}return U(a,[{key:"equals",value:function(t){return this._bn.eq(t._bn)}},{key:"toBase58",value:function(){return fr.encode(this.toBytes())}},{key:"toJSON",value:function(){return this.toBase58()}},{key:"toBytes",value:function(){var t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}},{key:"toBuffer",value:function(){var t=this._bn.toArrayLike(It);if(t.length===$s)return t;var e=It.alloc(32);return t.copy(e,32-t.length),e}},{key:e,get:function(){return"PublicKey(".concat(this.toString(),")")}},{key:"toString",value:function(){return this.toBase58()}}],[{key:"unique",value:function(){var t=new a(tu);return tu+=1,new a(t.toBuffer())}},{key:"createWithSeed",value:(i=_(O().mark((function t(e,n,r){var i,o;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=It.concat([e.toBuffer(),It.from(n),r.toBuffer()]),o=wr(i),t.abrupt("return",new a(o));case 3:case"end":return t.stop()}}),t)}))),function(t,e,n){return i.apply(this,arguments)})},{key:"createProgramAddressSync",value:function(t,e){var n=It.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");n=It.concat([n,Zs(t)])})),n=It.concat([n,e.toBuffer(),It.from("ProgramDerivedAddress")]);var r=wr(n);if(Vs(r))throw new Error("Invalid seeds, address must fall off the curve");return new a(r)}},{key:"createProgramAddress",value:(r=_(O().mark((function t(e,n){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.createProgramAddressSync(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"findProgramAddressSync",value:function(t,e){for(var n,r=255;0!=r;){try{var i=t.concat(It.from([r]));n=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}},{key:"findProgramAddress",value:(n=_(O().mark((function t(e,n){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.findProgramAddressSync(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"isOnCurve",value:function(t){return Vs(new a(t).toBytes())}}]),a}(Js,Symbol.toStringTag);Hs=eu,eu.default=new Hs("11111111111111111111111111111111"),Ks.set(eu,{kind:"struct",fields:[["_bn","u256"]]});var nu=function(){function t(e){if(B(this,t),this._publicKey=void 0,this._secretKey=void 0,e){var n=Zs(e);if(64!==e.length)throw new Error("bad secret key size");this._publicKey=n.slice(32,64),this._secretKey=n.slice(0,32)}else this._secretKey=Zs(Ys()),this._publicKey=Zs(Fs(this._secretKey))}return U(t,[{key:"publicKey",get:function(){return new eu(this._publicKey)}},{key:"secretKey",get:function(){return It.concat([this._secretKey,this._publicKey],64)}}]),t}(),ru=new eu("BPFLoader1111111111111111111111111111111111"),iu=1232,ou=127,au=64,su=function(t){Y(n,t);var e=X(n);function n(t){var r;return B(this,n),(r=e.call(this,"Signature ".concat(t," has expired: block height exceeded."))).signature=void 0,r.signature=t,r}return U(n)}(G(Error));Object.defineProperty(su.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var uu=function(t){Y(n,t);var e=X(n);function n(t,r){var i;return B(this,n),(i=e.call(this,"Transaction was not confirmed in ".concat(r.toFixed(2)," seconds. It is ")+"unknown if it succeeded or failed. Check signature "+"".concat(t," using the Solana Explorer or CLI tools."))).signature=void 0,i.signature=t,i}return U(n)}(G(Error));Object.defineProperty(uu.prototype,"name",{value:"TransactionExpiredTimeoutError"});var cu=function(t){Y(n,t);var e=X(n);function n(t){var r;return B(this,n),(r=e.call(this,"Signature ".concat(t," has expired: the nonce is no longer valid."))).signature=void 0,r.signature=t,r}return U(n)}(G(Error));Object.defineProperty(cu.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});var lu=function(){function t(e,n){B(this,t),this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=n}return U(t,[{key:"keySegments",value:function(){var t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}},{key:"get",value:function(t){var e,n=st(this.keySegments());try{for(n.s();!(e=n.n()).done;){var r=e.value;if(t256)throw new Error("Account index overflow encountered during compilation");var e=new Map;this.keySegments().flat().forEach((function(t,n){e.set(t.toBase58(),n)}));var n=function(t){var n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((function(t){return{programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((function(t){return n(t.pubkey)})),data:t.data}}))}}]),t}(),hu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey";return Ji(32,t)},du=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature";return Ji(64,t)},fu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",e=qi([Vi("length"),Vi("lengthPadding"),Ji(Yi(Vi(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),i=e;return i.decode=function(t,e){return n(t,e).chars.toString()},i.encode=function(t,e,n){var i={chars:It.from(t,"utf8")};return r(i,e,n)},i.alloc=function(t){return Vi().span+Vi().span+It.from(t,"utf8").length},i};function pu(t,e){var n=function t(n){if(n.span>=0)return n.span;if("function"==typeof n.alloc)return n.alloc(e[n.property]);if("count"in n&&"elementLayout"in n){var r=e[n.property];if(Array.isArray(r))return r.length*t(n.elementLayout)}else if("fields"in n)return pu({layout:n},e[n.property]);return 0},r=0;return t.layout.fields.forEach((function(t){r+=n(t)})),r}function yu(t){for(var e=0,n=0;;){var r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function mu(t,e){for(var n=e;;){var r=127&n;if(0==(n>>=7)){t.push(r);break}r|=128,t.push(r)}}function gu(t,e){if(!t)throw new Error(e||"Assertion failed")}var vu=function(){function t(e,n){B(this,t),this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=n}return U(t,[{key:"getMessageComponents",value:function(){var t=et(this.keyMetaMap.entries());gu(t.length<=256,"Max static account keys length exceeded");var e=t.filter((function(t){var e=tt(t,2)[1];return e.isSigner&&e.isWritable})),n=t.filter((function(t){var e=tt(t,2)[1];return e.isSigner&&!e.isWritable})),r=t.filter((function(t){var e=tt(t,2)[1];return!e.isSigner&&e.isWritable})),i=t.filter((function(t){var e=tt(t,2)[1];return!e.isSigner&&!e.isWritable})),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};return gu(e.length>0,"Expected at least one writable signer key"),gu(tt(e[0],1)[0]===this.payer.toBase58(),"Expected first writable signer key to be the fee payer"),[o,[].concat(et(e.map((function(t){var e=tt(t,1)[0];return new eu(e)}))),et(n.map((function(t){var e=tt(t,1)[0];return new eu(e)}))),et(r.map((function(t){var e=tt(t,1)[0];return new eu(e)}))),et(i.map((function(t){var e=tt(t,1)[0];return new eu(e)}))))]}},{key:"extractTableLookup",value:function(t){var e=tt(this.drainKeysFoundInLookupTable(t.state.addresses,(function(t){return!t.isSigner&&!t.isInvoked&&t.isWritable})),2),n=e[0],r=e[1],i=tt(this.drainKeysFoundInLookupTable(t.state.addresses,(function(t){return!t.isSigner&&!t.isInvoked&&!t.isWritable})),2),o=i[0],a=i[1];if(0!==n.length||0!==o.length)return[{accountKey:t.key,writableIndexes:n,readonlyIndexes:o},{writable:r,readonly:a}]}},{key:"drainKeysFoundInLookupTable",value:function(t,e){var n,r=this,i=new Array,o=new Array,a=st(this.keyMetaMap.entries());try{var s=function(){var a=tt(n.value,2),s=a[0],u=a[1];if(e(u)){var c=new eu(s),l=t.findIndex((function(t){return t.equals(c)}));l>=0&&(gu(l<256,"Max lookup table index exceeded"),i.push(l),o.push(c),r.keyMetaMap.delete(s))}};for(a.s();!(n=a.n()).done;)s()}catch(t){a.e(t)}finally{a.f()}return[i,o]}}],[{key:"compile",value:function(e,n){var r=new Map,i=function(t){var e=t.toBase58(),n=r.get(e);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(e,n)),n},o=i(n);o.isSigner=!0,o.isWritable=!0;var a,s=st(e);try{for(s.s();!(a=s.n()).done;){var u=a.value;i(u.programId).isInvoked=!0;var c,l=st(u.keys);try{for(l.s();!(c=l.n()).done;){var h=c.value,d=i(h.pubkey);d.isSigner||(d.isSigner=h.isSigner),d.isWritable||(d.isWritable=h.isWritable)}}catch(t){l.e(t)}finally{l.f()}}}catch(t){s.e(t)}finally{s.f()}return new t(n,r)}}]),t}(),wu=function(){function t(e){var n=this;B(this,t),this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map((function(t){return new eu(t)})),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach((function(t){return n.indexToProgramIds.set(t.programIdIndex,n.accountKeys[t.programIdIndex])}))}return U(t,[{key:"version",get:function(){return"legacy"}},{key:"staticAccountKeys",get:function(){return this.accountKeys}},{key:"compiledInstructions",get:function(){return this.instructions.map((function(t){return{programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:fr.decode(t.data)}}))}},{key:"addressTableLookups",get:function(){return[]}},{key:"getAccountKeys",value:function(){return new lu(this.staticAccountKeys)}},{key:"isAccountSigner",value:function(t){return t=this.header.numRequiredSignatures?t-e0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new lu(this.staticAccountKeys,e)}},{key:"isAccountSigner",value:function(t){return t=n?t-n=this.header.numRequiredSignatures?t-e0?this.signatures[0].signature:null}},{key:"toJSON",value:function(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((function(t){return t.toJSON()})),signers:this.signatures.map((function(t){return t.publicKey.toJSON()}))}}},{key:"add",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(var r=0;r-1?(a[n].isWritable=a[n].isWritable||t.isWritable,a[n].isSigner=a[n].isSigner||t.isSigner):a.push(t)})),a.sort((function(t,e){if(t.isSigner!==e.isSigner)return t.isSigner?-1:1;if(t.isWritable!==e.isWritable)return t.isWritable?-1:1;return t.pubkey.toBase58().localeCompare(e.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));var s=a.findIndex((function(t){return t.pubkey.equals(n)}));if(s>-1){var u=tt(a.splice(s,1),1)[0];u.isSigner=!0,u.isWritable=!0,a.unshift(u)}else a.unshift({pubkey:n,isSigner:!0,isWritable:!0});var c,l=st(this.signatures);try{var h=function(){var t=c.value,e=a.findIndex((function(e){return e.pubkey.equals(t.publicKey)}));if(!(e>-1))throw new Error("unknown signer: ".concat(t.publicKey.toString()));a[e].isSigner||(a[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))};for(l.s();!(c=l.n()).done;)h()}catch(t){l.e(t)}finally{l.f()}var d=0,f=0,p=0,y=[],m=[];a.forEach((function(t){var e=t.pubkey,n=t.isSigner,r=t.isWritable;n?(y.push(e.toString()),d+=1,r||(f+=1)):(m.push(e.toString()),r||(p+=1))}));var g=y.concat(m),v=e.map((function(t){var e=t.data,n=t.programId;return{programIdIndex:g.indexOf(n.toString()),accounts:t.keys.map((function(t){return g.indexOf(t.pubkey.toString())})),data:fr.encode(e)}}));return v.forEach((function(t){gu(t.programIdIndex>=0),t.accounts.forEach((function(t){return gu(t>=0)}))})),new wu({header:{numRequiredSignatures:d,numReadonlySignedAccounts:f,numReadonlyUnsignedAccounts:p},accountKeys:g,recentBlockhash:t,instructions:v})}},{key:"_compile",value:function(){var t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);if(this.signatures.length===e.length&&this.signatures.every((function(t,n){return e[n].equals(t.publicKey)})))return t;return this.signatures=e.map((function(t){return{signature:null,publicKey:t}})),t}},{key:"serializeMessage",value:function(){return this._compile().serialize()}},{key:"getEstimatedFee",value:(e=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getFeeForMessage(this.compileMessage());case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"setSigners",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n1?r-1:0),o=1;o ").concat(iu)),i}},{key:"keys",get:function(){return gu(1===this.instructions.length),this.instructions[0].keys.map((function(t){return t.pubkey}))}},{key:"programId",get:function(){return gu(1===this.instructions.length),this.instructions[0].programId}},{key:"data",get:function(){return gu(1===this.instructions.length),this.instructions[0].data}}],[{key:"from",value:function(e){for(var n=et(e),r=yu(n),i=[],o=0;o1&&void 0!==arguments[1]?arguments[1]:[],r=new t;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),n.forEach((function(t,n){var i={signature:t==fr.encode(Nu)?null:fr.decode(t),publicKey:e.accountKeys[n]};r.signatures.push(i)})),e.instructions.forEach((function(t){var n=t.accounts.map((function(t){var n=e.accountKeys[t];return{pubkey:n,isSigner:r.signatures.some((function(t){return t.publicKey.toString()===n.toString()}))||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}}));r.instructions.push(new Iu({keys:n,programId:e.accountKeys[t.programIdIndex],data:fr.decode(t.data)}))})),r._message=e,r._json=r.toJSON(),r}}]),t}(),xu=function(){function t(e){B(this,t),this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}return U(t,[{key:"compileToLegacyMessage",value:function(){return wu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}},{key:"compileToV0Message",value:function(t){return bu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:t})}}],[{key:"decompile",value:function(e,n){var r=e.header,i=e.compiledInstructions,o=e.recentBlockhash,a=r.numRequiredSignatures,s=r.numReadonlySignedAccounts,u=r.numReadonlyUnsignedAccounts,c=a-s;gu(c>0,"Message header is invalid");var l=e.staticAccountKeys.length-a-u;gu(l>=0,"Message header is invalid");var h=e.getAccountKeys(n),d=h.get(0);if(void 0===d)throw new Error("Failed to decompile message because no account keys were found");var f,p=[],y=st(i);try{for(y.s();!(f=y.n()).done;){var m,g=f.value,v=[],w=st(g.accountKeyIndexes);try{for(w.s();!(m=w.n()).done;){var b=m.value,M=h.get(b);if(void 0===M)throw new Error("Failed to find key for account key index ".concat(b));var A=void 0;A=b=0,"Cannot sign with non signer key ".concat(t.publicKey.toBase58())),n.signatures[o]=Gs(r,t.secretKey)};for(o.s();!(e=o.n()).done;)a()}catch(t){o.e(t)}finally{o.f()}}},{key:"addSignature",value:function(t,e){gu(64===e.byteLength,"Signature must be 64 bytes long");var n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((function(e){return e.equals(t)}));gu(n>=0,"Can not add signature; `".concat(t.toBase58(),"` is not required to sign this transaction")),this.signatures[n]=e}}],[{key:"deserialize",value:function(e){for(var n=et(e),r=[],i=yu(n),o=0;o=0?t.layout.span:pu(t,e),r=It.alloc(n),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,r),r}function Qu(t,e){var n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error("invalid instruction; instruction index mismatch ".concat(n.instruction," != ").concat(t.index));return n}var Yu,Wu=Hi("lamportsPerSignature"),Fu=qi([Vi("version"),Vi("state"),hu("authorizedPubkey"),hu("nonce"),qi([Wu],"feeCalculator")]),Vu=Fu.span,Hu=function(){function t(e){B(this,t),this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}return U(t,null,[{key:"fromAccountData",value:function(e){var n=Fu.decode(Zs(e),0);return new t({authorizedPubkey:new eu(n.authorizedPubkey),nonce:new eu(n.nonce).toString(),feeCalculator:n.feeCalculator})}}]),t}(),Gu=(Yu=8,function(t){var e=Ji(Yu,t),n=function(t){return{decode:t.decode.bind(t),encode:t.encode.bind(t)}}(e),r=n.encode,i=n.decode,o=e;return o.decode=function(t,e){var n=i(t,e);return Ki(It.from(n))},o.encode=function(t,e,n){var i=$i(t,Yu);return r(i,e,n)},o}),qu=function(){function t(){B(this,t)}return U(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=Vi("instruction").decode(t.data),r=0,i=Object.entries(Zu);r0?s:1,space:a.length,programId:o}));case 17:if(null===c){e.next=20;break}return e.next=20,_u(n,c,[r,i],{commitment:"confirmed"});case 20:l=qi([Vi("instruction"),Vi("offset"),Vi("bytesLength"),Vi("bytesLengthPadding"),Zi(Wi("byte"),Yi(Vi(),-8),"bytes")]),h=t.chunkSize,d=0,f=a,p=[];case 25:if(!(f.length>0)){e.next=39;break}if(y=f.slice(0,h),m=It.alloc(h+16),l.encode({instruction:0,offset:d,bytes:y,bytesLength:0,bytesLengthPadding:0},m),g=(new Eu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:m}),p.push(_u(n,g,[r,i],{commitment:"confirmed"})),!n._rpcEndpoint.includes("solana.com")){e.next=35;break}return e.next=35,Ru(250);case 35:d+=h,f=f.slice(h),e.next=25;break;case 39:return e.next=41,Promise.all(p);case 41:return v=qi([Vi("instruction")]),w=It.alloc(v.span),v.encode({instruction:1},w),b=(new Eu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0},{pubkey:Cu,isSigner:!1,isWritable:!1}],programId:o,data:w}),M="processed",e.next=48,n.sendTransaction(b,[r,i],{preflightCommitment:M});case 48:return A=e.sent,e.next=51,n.confirmTransaction({signature:A,lastValidBlockHeight:b.lastValidBlockHeight,blockhash:b.recentBlockhash},M);case 51:if(N=e.sent,I=N.context,!(E=N.value).err){e.next=56;break}throw new Error("Transaction ".concat(A," failed (").concat(JSON.stringify(E),")"));case 56:return e.prev=57,e.next=60,n.getSlot({commitment:M});case 60:if(!(e.sent>I.slot)){e.next=63;break}return e.abrupt("break",71);case 63:e.next=67;break;case 65:e.prev=65,e.t0=e.catch(57);case 67:return e.next=69,new Promise((function(t){return setTimeout(t,Math.round(200))}));case 69:e.next=56;break;case 71:return e.abrupt("return",!0);case 72:case"end":return e.stop()}}),e,null,[[57,65]])}))),function(t,n,r,i,o){return e.apply(this,arguments)})}]),t}();Xu.chunkSize=932;var Ku=new eu("BPFLoader2111111111111111111111111111111111"),$u=function(){function t(){B(this,t)}return U(t,null,[{key:"getMinNumSignatures",value:function(t){return Xu.getMinNumSignatures(t)}},{key:"load",value:function(t,e,n,r,i){return Xu.load(t,e,n,i,r)}}]),t}();function tc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ec=Object.prototype.toString,nc=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function rc(t,e){var n,r,i,o,a,s,u;if(!0===t)return"true";if(!1===t)return"false";switch(z(t)){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return rc(t.toJSON(),e);if("[object Array]"===(u=ec.call(t))){for(i="[",r=t.length-1,n=0;n-1&&(i+=rc(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=nc(t).sort()).length,i="",n=0;n1;)t/=2,e++;return e}var ac=function(){function t(e,n,r,i,o){B(this,t),this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=n,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=o}return U(t,[{key:"getEpoch",value:function(t){return this.getEpochAndSlotIndex(t)[0]}},{key:"getEpochAndSlotIndex",value:function(t){if(t>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32))}(t+32+1))-oc(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}var n=t-this.firstNormalSlot,r=Math.floor(n/this.slotsPerEpoch);return[this.firstNormalEpoch+r,n%this.slotsPerEpoch]}},{key:"getFirstSlotInEpoch",value:function(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}},{key:"getLastSlotInEpoch",value:function(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}},{key:"getSlotsInEpoch",value:function(t){return t0&&(i.until=a.signatures[a.signatures.length-1].toString()),t.next=22;break;case 15:if(t.prev=15,t.t0=t.catch(8),!(t.t0 instanceof Error&&t.t0.message.includes("skipped"))){t.next=21;break}return t.abrupt("continue",4);case 21:throw t.t0;case 22:t.next=4;break;case 24:return t.next=26,this.getSlot("finalized");case 26:s=t.sent;case 27:if("before"in i){t.next=47;break}if(!(++r>s)){t.next=31;break}return t.abrupt("break",47);case 31:return t.prev=31,t.next=34,this.getConfirmedBlockSignatures(r);case 34:(u=t.sent).signatures.length>0&&(i.before=u.signatures[u.signatures.length-1].toString()),t.next=45;break;case 38:if(t.prev=38,t.t1=t.catch(31),!(t.t1 instanceof Error&&t.t1.message.includes("skipped"))){t.next=44;break}return t.abrupt("continue",27);case 44:throw t.t1;case 45:t.next=27;break;case 47:return t.next=49,this.getConfirmedSignaturesForAddress2(e,i);case 49:return c=t.sent,t.abrupt("return",c.map((function(t){return t.signature})));case 51:case"end":return t.stop()}}),t,this,[[8,15],[31,38]])}))),function(t,e,n){return N.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress2",value:(A=_(O().mark((function t(e,n,r){var i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,n),t.next=3,this._rpcRequest("getConfirmedSignaturesForAddress2",i);case 3:if(o=t.sent,!("error"in(a=po(o,rl)))){t.next=7;break}throw new uc(a.error,"failed to get confirmed signatures for address");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return A.apply(this,arguments)})},{key:"getSignaturesForAddress",value:(M=_(O().mark((function t(e,n,r){var i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,n),t.next=3,this._rpcRequest("getSignaturesForAddress",i);case 3:if(o=t.sent,!("error"in(a=po(o,il)))){t.next=7;break}throw new uc(a.error,"failed to get signatures for address");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return M.apply(this,arguments)})},{key:"getAddressLookupTable",value:(b=_(O().mark((function t(e,n){var r,i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAccountInfoAndContext(e,n);case 2:return r=t.sent,i=r.context,o=r.value,a=null,null!==o&&(a=new hc({key:e,state:hc.deserialize(o.data)})),t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return b.apply(this,arguments)})},{key:"getNonceAndContext",value:(w=_(O().mark((function t(e,n){var r,i,o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAccountInfoAndContext(e,n);case 2:return r=t.sent,i=r.context,o=r.value,a=null,null!==o&&(a=Hu.fromAccountData(o.data)),t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return w.apply(this,arguments)})},{key:"getNonce",value:(v=_(O().mark((function t(e,n){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getNonceAndContext(e,n).then((function(t){return t.value})).catch((function(t){throw new Error("failed to get nonce for account "+e.toBase58()+": "+t)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return v.apply(this,arguments)})},{key:"requestAirdrop",value:(g=_(O().mark((function t(e,n){var r,i;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("requestAirdrop",[e.toBase58(),n]);case 2:if(r=t.sent,!("error"in(i=po(r,Jl)))){t.next=6;break}throw new uc(i.error,"airdrop to ".concat(e.toBase58()," failed"));case 6:return t.abrupt("return",i.result);case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return g.apply(this,arguments)})},{key:"_blockhashWithExpiryBlockHeight",value:(m=_(O().mark((function t(e){var n,r;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=10;break}case 1:if(!this._pollingBlockhash){t.next=6;break}return t.next=4,Ru(100);case 4:t.next=1;break;case 6:if(n=Date.now()-this._blockhashInfo.lastFetch,r=n>=3e4,null===this._blockhashInfo.latestBlockhash||r){t.next=10;break}return t.abrupt("return",this._blockhashInfo.latestBlockhash);case 10:return t.next=12,this._pollNewBlockhash();case 12:return t.abrupt("return",t.sent);case 13:case"end":return t.stop()}}),t,this)}))),function(t){return m.apply(this,arguments)})},{key:"_pollNewBlockhash",value:(y=_(O().mark((function t(){var e,n,r,i,o;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._pollingBlockhash=!0,t.prev=1,e=Date.now(),n=this._blockhashInfo.latestBlockhash,r=n?n.blockhash:null,i=0;case 6:if(!(i<50)){t.next=18;break}return t.next=9,this.getLatestBlockhash("finalized");case 9:if(o=t.sent,r===o.blockhash){t.next=13;break}return this._blockhashInfo={latestBlockhash:o,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t.abrupt("return",o);case 13:return t.next=15,Ru(200);case 15:i++,t.next=6;break;case 18:throw new Error("Unable to obtain a new blockhash after ".concat(Date.now()-e,"ms"));case 19:return t.prev=19,this._pollingBlockhash=!1,t.finish(19);case 22:case"end":return t.stop()}}),t,this,[[1,,19,22]])}))),function(){return y.apply(this,arguments)})},{key:"getStakeMinimumDelegation",value:(p=_(O().mark((function t(e){var n,r,i,o,a,s;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=gc(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,"base64",i),t.next=4,this._rpcRequest("getStakeMinimumDelegation",o);case 4:if(a=t.sent,!("error"in(s=po(a,Mc(No()))))){t.next=8;break}throw new uc(s.error,"failed to get stake minimum delegation");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return p.apply(this,arguments)})},{key:"simulateTransaction",value:(f=_(O().mark((function t(e,n,r){var i,o,a,s,u,c,l,h,d,f,p,y,m,g,v,w,b,M,A,N,I,E,x,k,T,L;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("message"in e)){t.next=17;break}if(i=e.serialize(),o=It.from(i).toString("base64"),!Array.isArray(n)&&void 0===r){t.next=6;break}throw new Error("Invalid arguments");case 6:return(a=n||{}).encoding="base64","commitment"in a||(a.commitment=this.commitment),s=[o,a],t.next=12,this._rpcRequest("simulateTransaction",s);case 12:if(u=t.sent,!("error"in(c=po(u,zc)))){t.next=16;break}throw new Error("failed to simulate transaction: "+c.error.message);case 16:return t.abrupt("return",c.result);case 17:if(e instanceof Eu?(h=e,(l=new Eu).feePayer=h.feePayer,l.instructions=e.instructions,l.nonceInfo=h.nonceInfo,l.signatures=h.signatures):(l=Eu.populate(e))._message=l._json=void 0,void 0===n||Array.isArray(n)){t.next=20;break}throw new Error("Invalid arguments");case 20:if(d=n,!l.nonceInfo||!d){t.next=25;break}(f=l).sign.apply(f,et(d)),t.next=45;break;case 25:p=this._disableBlockhashCaching;case 26:return t.next=28,this._blockhashWithExpiryBlockHeight(p);case 28:if(m=t.sent,l.lastValidBlockHeight=m.lastValidBlockHeight,l.recentBlockhash=m.blockhash,d){t.next=33;break}return t.abrupt("break",45);case 33:if((y=l).sign.apply(y,et(d)),l.signature){t.next=36;break}throw new Error("!signature");case 36:if(g=l.signature.toString("base64"),this._blockhashInfo.simulatedSignatures.includes(g)||this._blockhashInfo.transactionSignatures.includes(g)){t.next=42;break}return this._blockhashInfo.simulatedSignatures.push(g),t.abrupt("break",45);case 42:p=!0;case 43:t.next=26;break;case 45:return v=l._compile(),w=v.serialize(),b=l._serialize(w),M=b.toString("base64"),A={encoding:"base64",commitment:this.commitment},r&&(N=(Array.isArray(r)?r:v.nonProgramIds()).map((function(t){return t.toBase58()})),A.accounts={encoding:"base64",addresses:N}),d&&(A.sigVerify=!0),I=[M,A],t.next=55,this._rpcRequest("simulateTransaction",I);case 55:if(E=t.sent,!("error"in(x=po(E,zc)))){t.next=60;break}throw"data"in x.error&&(k=x.error.data.logs)&&Array.isArray(k)&&(L=(T="\n ")+k.join(T),console.error(x.error.message,L)),new sc("failed to simulate transaction: "+x.error.message,k);case 60:return t.abrupt("return",x.result);case 61:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return f.apply(this,arguments)})},{key:"sendTransaction",value:(d=_(O().mark((function t(e,n,r){var i,o,a,s,u,c;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("version"in e)){t.next=7;break}if(!n||!Array.isArray(n)){t.next=3;break}throw new Error("Invalid arguments");case 3:return i=e.serialize(),t.next=6,this.sendRawTransaction(i,n);case 6:return t.abrupt("return",t.sent);case 7:if(void 0!==n&&Array.isArray(n)){t.next=9;break}throw new Error("Invalid arguments");case 9:if(o=n,!e.nonceInfo){t.next=14;break}e.sign.apply(e,et(o)),t.next=32;break;case 14:a=this._disableBlockhashCaching;case 15:return t.next=17,this._blockhashWithExpiryBlockHeight(a);case 17:if(s=t.sent,e.lastValidBlockHeight=s.lastValidBlockHeight,e.recentBlockhash=s.blockhash,e.sign.apply(e,et(o)),e.signature){t.next=23;break}throw new Error("!signature");case 23:if(u=e.signature.toString("base64"),this._blockhashInfo.transactionSignatures.includes(u)){t.next=29;break}return this._blockhashInfo.transactionSignatures.push(u),t.abrupt("break",32);case 29:a=!0;case 30:t.next=15;break;case 32:return c=e.serialize(),t.next=35,this.sendRawTransaction(c,r);case 35:return t.abrupt("return",t.sent);case 36:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return d.apply(this,arguments)})},{key:"sendRawTransaction",value:(h=_(O().mark((function t(e,n){var r,i;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Zs(e).toString("base64"),t.next=3,this.sendEncodedTransaction(r,n);case 3:return i=t.sent,t.abrupt("return",i);case 5:case"end":return t.stop()}}),t,this)}))),function(t,e){return h.apply(this,arguments)})},{key:"sendEncodedTransaction",value:(l=_(O().mark((function t(e,n){var r,i,o,a,s,u,c;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={encoding:"base64"},i=n&&n.skipPreflight,o=n&&n.preflightCommitment||this.commitment,n&&null!=n.maxRetries&&(r.maxRetries=n.maxRetries),n&&null!=n.minContextSlot&&(r.minContextSlot=n.minContextSlot),i&&(r.skipPreflight=i),o&&(r.preflightCommitment=o),a=[e,r],t.next=10,this._rpcRequest("sendTransaction",a);case 10:if(s=t.sent,!("error"in(u=po(s,Xl)))){t.next=15;break}throw"data"in u.error&&(c=u.error.data.logs),new sc("failed to send transaction: "+u.error.message,c);case 15:return t.abrupt("return",u.result);case 16:case"end":return t.stop()}}),t,this)}))),function(t,e){return l.apply(this,arguments)})},{key:"_wsOnOpen",value:function(){var t=this;this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((function(){_(O().mark((function e(){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t._rpcWebSocket.notify("ping");case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})))()}),5e3),this._updateSubscriptions()}},{key:"_wsOnError",value:function(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}},{key:"_wsOnClose",value:function(t){var e=this;this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((function(t){var n=tt(t,2),r=n[0],i=n[1];e._setSubscription(r,D(D({},i),{},{state:"pending"}))}))):this._updateSubscriptions()}},{key:"_setSubscription",value:function(t,e){var n,r=null===(n=this._subscriptionsByHash[t])||void 0===n?void 0:n.state;if(this._subscriptionsByHash[t]=e,r!==e.state){var i=this._subscriptionStateChangeCallbacksByHash[t];i&&i.forEach((function(t){try{t(e.state)}catch(t){}}))}}},{key:"_onSubscriptionStateChange",value:function(t,e){var n,r=this,i=this._subscriptionHashByClientSubscriptionId[t];if(null==i)return function(){};var o=(n=this._subscriptionStateChangeCallbacksByHash)[i]||(n[i]=new Set);return o.add(e),function(){o.delete(e),0===o.size&&delete r._subscriptionStateChangeCallbacksByHash[i]}}},{key:"_updateSubscriptions",value:(c=_(O().mark((function t(){var e,n,r=this;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==Object.keys(this._subscriptionsByHash).length){t.next=3;break}return this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((function(){r._rpcWebSocketIdleTimeout=null;try{r._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log("Error when closing socket connection: ".concat(t.message))}}),500)),t.abrupt("return");case 3:if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),this._rpcWebSocketConnected){t.next=7;break}return this._rpcWebSocket.connect(),t.abrupt("return");case 7:return e=this._rpcWebSocketGeneration,n=function(){return e===r._rpcWebSocketGeneration},t.next=11,Promise.all(Object.keys(this._subscriptionsByHash).map(function(){var t=_(O().mark((function t(e){var i;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(i=r._subscriptionsByHash[e])){t.next=3;break}return t.abrupt("return");case 3:t.t0=i.state,t.next="pending"===t.t0||"unsubscribed"===t.t0?6:"subscribed"===t.t0?15:19;break;case 6:if(0!==i.callbacks.size){t.next=12;break}return delete r._subscriptionsByHash[e],"unsubscribed"===i.state&&delete r._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],t.next=11,r._updateSubscriptions();case 11:return t.abrupt("return");case 12:return t.next=14,_(O().mark((function t(){var o,a,s;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=i.args,a=i.method,t.prev=1,r._setSubscription(e,D(D({},i),{},{state:"subscribing"})),t.next=5,r._rpcWebSocket.call(a,o);case 5:return s=t.sent,r._setSubscription(e,D(D({},i),{},{serverSubscriptionId:s,state:"subscribed"})),r._subscriptionCallbacksByServerSubscriptionId[s]=i.callbacks,t.next=10,r._updateSubscriptions();case 10:t.next=20;break;case 12:if(t.prev=12,t.t0=t.catch(1),t.t0 instanceof Error&&console.error("".concat(a," error for argument"),o,t.t0.message),n()){t.next=17;break}return t.abrupt("return");case 17:return r._setSubscription(e,D(D({},i),{},{state:"pending"})),t.next=20,r._updateSubscriptions();case 20:case"end":return t.stop()}}),t,null,[[1,12]])})))();case 14:return t.abrupt("break",19);case 15:if(0!==i.callbacks.size){t.next=18;break}return t.next=18,_(O().mark((function t(){var o,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=i.serverSubscriptionId,a=i.unsubscribeMethod,!r._subscriptionsAutoDisposedByRpc.has(o)){t.next=5;break}r._subscriptionsAutoDisposedByRpc.delete(o),t.next=21;break;case 5:return r._setSubscription(e,D(D({},i),{},{state:"unsubscribing"})),r._setSubscription(e,D(D({},i),{},{state:"unsubscribing"})),t.prev=7,t.next=10,r._rpcWebSocket.call(a,[o]);case 10:t.next=21;break;case 12:if(t.prev=12,t.t0=t.catch(7),t.t0 instanceof Error&&console.error("".concat(a," error:"),t.t0.message),n()){t.next=17;break}return t.abrupt("return");case 17:return r._setSubscription(e,D(D({},i),{},{state:"subscribed"})),t.next=20,r._updateSubscriptions();case 20:return t.abrupt("return");case 21:return r._setSubscription(e,D(D({},i),{},{state:"unsubscribed"})),t.next=24,r._updateSubscriptions();case 24:case"end":return t.stop()}}),t,null,[[7,12]])})))();case 18:return t.abrupt("break",19);case 19:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 11:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"_handleServerNotification",value:function(t,e){var n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((function(t){try{t.apply(void 0,et(e))}catch(t){console.error(t)}}))}},{key:"_wsOnAccountNotification",value:function(t){var e=po(t,ol),n=e.result,r=e.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_makeSubscription",value:function(t,e){var n=this,r=this._nextClientSubscriptionId++,i=ic([t.method,e],!0),o=this._subscriptionsByHash[i];return void 0===o?this._subscriptionsByHash[i]=D(D({},t),{},{args:e,callbacks:new Set([t.callback]),state:"pending"}):o.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=_(O().mark((function e(){var o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return delete n._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete n._subscriptionHashByClientSubscriptionId[r],gu(void 0!==(o=n._subscriptionsByHash[i]),"Could not find a `Subscription` when tearing down client subscription #".concat(r)),o.callbacks.delete(t.callback),e.next=7,n._updateSubscriptions();case 7:case"end":return e.stop()}}),e)}))),this._updateSubscriptions(),r}},{key:"onAccountChange",value:function(t,e,n){var r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}},{key:"removeAccountChangeListener",value:(u=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"account change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"_wsOnProgramAccountNotification",value:function(t){var e=po(t,sl),n=e.result,r=e.subscription;this._handleServerNotification(r,[{accountId:n.value.pubkey,accountInfo:n.value.account},n.context])}},{key:"onProgramAccountChange",value:function(t,e,n,r){var i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}},{key:"removeProgramAccountChangeListener",value:(s=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"program account change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"onLogs",value:function(t,e,n){var r=this._buildArgs(["object"===z(t)?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}},{key:"removeOnLogsListener",value:(a=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"logs");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"_wsOnLogsNotification",value:function(t){var e=po(t,$l),n=e.result,r=e.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_wsOnSlotNotification",value:function(t){var e=po(t,cl),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotChange",value:function(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}},{key:"removeSlotChangeListener",value:(o=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"slot change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"_wsOnSlotUpdatesNotification",value:function(t){var e=po(t,hl),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotUpdate",value:function(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}},{key:"removeSlotUpdateListener",value:(i=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"slot update");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"_unsubscribeClientSubscription",value:(r=_(O().mark((function t(e,n){var r;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r=this._subscriptionDisposeFunctionsByClientSubscriptionId[e])){t.next=6;break}return t.next=4,r();case 4:t.next=7;break;case 6:console.warn("Ignored unsubscribe request because an active subscription with id "+"`".concat(e,"` for '").concat(n,"' events ")+"could not be found.");case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"_buildArgs",value:function(t,e,n,r){var i=e||this._commitment;if(i||n||r){var o={};n&&(o.encoding=n),i&&(o.commitment=i),r&&(o=Object.assign(o,r)),t.push(o)}return t}},{key:"_buildArgsAtLeastConfirmed",value:function(t,e,n,r){var i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}},{key:"_wsOnSignatureNotification",value:function(t){var e=po(t,dl),n=e.result,r=e.subscription;"receivedSignature"!==n.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===n.value?[{type:"received"},n.context]:[{type:"status",result:n.value},n.context])}},{key:"onSignature",value:function(t,e,n){var r=this,i=this._buildArgs([t],n||this._commitment||"finalized"),o=this._makeSubscription({callback:function(t,n){if("status"===t.type){e(t.result,n);try{r.removeSignatureListener(o)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return o}},{key:"onSignatureWithOptions",value:function(t,e,n){var r=this,i=D(D({},n),{},{commitment:n&&n.commitment||this._commitment||"finalized"}),o=i.commitment,a=q(i,Qs),s=this._buildArgs([t],o,void 0,a),u=this._makeSubscription({callback:function(t,n){e(t,n);try{r.removeSignatureListener(u)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return u}},{key:"removeSignatureListener",value:(n=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"signature result");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"_wsOnRootNotification",value:function(t){var e=po(t,fl),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onRootChange",value:function(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}},{key:"removeRootChangeListener",value:(e=_(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"root change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),t}(),nh=function(){function t(e){B(this,t),this._keypair=void 0,this._keypair=null!=e?e:Ws()}return U(t,[{key:"publicKey",get:function(){return new eu(this._keypair.publicKey)}},{key:"secretKey",get:function(){return new Uint8Array(this._keypair.secretKey)}}],[{key:"generate",value:function(){return new t(Ws())}},{key:"fromSecretKey",value:function(e,n){if(64!==e.byteLength)throw new Error("bad secret key size");var r=e.slice(32,64);if(!n||!n.skipValidation)for(var i=e.slice(0,32),o=Fs(i),a=0;a<32;a++)if(r[a]!==o[a])throw new Error("provided secretKey is invalid");return new t({publicKey:r,secretKey:e})}},{key:"fromSeed",value:function(e){var n=Fs(e),r=new Uint8Array(64);return r.set(e),r.set(n,32),new t({publicKey:n,secretKey:r})}}]),t}(),rh=Object.freeze({CreateLookupTable:{index:0,layout:qi([Vi("instruction"),Gu("recentSlot"),Wi("bumpSeed")])},FreezeLookupTable:{index:1,layout:qi([Vi("instruction")])},ExtendLookupTable:{index:2,layout:qi([Vi("instruction"),Gu(),Zi(hu(),Yi(Vi(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:qi([Vi("instruction")])},CloseLookupTable:{index:4,layout:qi([Vi("instruction")])}}),ih=function(){function t(){B(this,t)}return U(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=Vi("instruction").decode(t.data),r=0,i=Object.entries(rh);r2?t.keys[2].pubkey:void 0,addresses:e.map((function(t){return new eu(t)}))}}},{key:"decodeCloseLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}},{key:"decodeFreezeLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}},{key:"decodeDeactivateLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(oh.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}},{key:"checkKeysLength",value:function(t,e){if(t.length3&&(i.custodianPubkey=t.keys[3].pubkey),i}},{key:"decodeAuthorizeWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=Qu(wh.AuthorizeWithSeed,t.data),n=e.newAuthorized,r=e.stakeAuthorizationType,i=e.authoritySeed,o=e.authorityOwner,a={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:i,authorityOwner:new eu(o),newAuthorizedPubkey:new eu(n),stakeAuthorizationType:{index:r}};return t.keys.length>3&&(a.custodianPubkey=t.keys[3].pubkey),a}},{key:"decodeSplit",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=Qu(wh.Split,t.data).lamports;return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}},{key:"decodeMerge",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Qu(wh.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}},{key:"decodeWithdraw",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);var e=Qu(wh.Withdraw,t.data).lamports,n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}},{key:"decodeDeactivate",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),Qu(wh.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(Mh.programId))throw new Error("invalid instruction; programId is not StakeProgram")}},{key:"checkKeyLength",value:function(t,e){if(t.length0&&void 0!==arguments[0]?arguments[0]:"authorized";return qi([hu("staker"),hu("withdrawer")],t)}(),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return qi([Gi("unixTimestamp"),Gi("epoch"),hu("custodian")],t)}()])},Authorize:{index:1,layout:qi([Vi("instruction"),hu("newAuthorized"),Vi("stakeAuthorizationType")])},Delegate:{index:2,layout:qi([Vi("instruction")])},Split:{index:3,layout:qi([Vi("instruction"),Gi("lamports")])},Withdraw:{index:4,layout:qi([Vi("instruction"),Gi("lamports")])},Deactivate:{index:5,layout:qi([Vi("instruction")])},Merge:{index:7,layout:qi([Vi("instruction")])},AuthorizeWithSeed:{index:8,layout:qi([Vi("instruction"),hu("newAuthorized"),Vi("stakeAuthorizationType"),fu("authoritySeed"),hu("authorityOwner")])}}),bh=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),Mh=function(){function t(){B(this,t)}return U(t,null,[{key:"initialize",value:function(t){var e=t.stakePubkey,n=t.authorized,r=t.lockup||gh.default,i=Uu(wh.Initialize,{authorized:{staker:Zs(n.staker.toBuffer()),withdrawer:Zs(n.withdrawer.toBuffer())},lockup:{unixTimestamp:r.unixTimestamp,epoch:r.epoch,custodian:Zs(r.custodian.toBuffer())}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Cu,isSigner:!1,isWritable:!1}],programId:this.programId,data:i};return new Iu(o)}},{key:"createAccountWithSeed",value:function(t){var e=new Eu;e.add(Ju.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));var n=t.stakePubkey,r=t.authorized,i=t.lockup;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"createAccount",value:function(t){var e=new Eu;e.add(Ju.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));var n=t.stakePubkey,r=t.authorized,i=t.lockup;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"delegate",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.votePubkey,i=Uu(wh.Delegate);return(new Eu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:Pu,isSigner:!1,isWritable:!1},{pubkey:yh,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"authorize",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.newAuthorizedPubkey,i=t.stakeAuthorizationType,o=t.custodianPubkey,a=Uu(wh.Authorize,{newAuthorized:Zs(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Tu,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new Eu).add({keys:s,programId:this.programId,data:a})}},{key:"authorizeWithSeed",value:function(t){var e=t.stakePubkey,n=t.authorityBase,r=t.authoritySeed,i=t.authorityOwner,o=t.newAuthorizedPubkey,a=t.stakeAuthorizationType,s=t.custodianPubkey,u=Uu(wh.AuthorizeWithSeed,{newAuthorized:Zs(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:Zs(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:Tu,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new Eu).add({keys:c,programId:this.programId,data:u})}},{key:"splitInstruction",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.splitStakePubkey,i=t.lamports,o=Uu(wh.Split,{lamports:i});return new Iu({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}},{key:"split",value:function(t){var e=new Eu;return e.add(Ju.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}},{key:"splitWithSeed",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.splitStakePubkey,i=t.basePubkey,o=t.seed,a=t.lamports,s=new Eu;return s.add(Ju.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}},{key:"merge",value:function(t){var e=t.stakePubkey,n=t.sourceStakePubKey,r=t.authorizedPubkey,i=Uu(wh.Merge);return(new Eu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:Pu,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"withdraw",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.toPubkey,i=t.lamports,o=t.custodianPubkey,a=Uu(wh.Withdraw,{lamports:i}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:Pu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new Eu).add({keys:s,programId:this.programId,data:a})}},{key:"deactivate",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=Uu(wh.Deactivate);return(new Eu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}]),t}();Mh.programId=new eu("Stake11111111111111111111111111111111111111"),Mh.space=200;var Ah=U((function t(e,n,r,i){B(this,t),this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=e,this.authorizedVoter=n,this.authorizedWithdrawer=r,this.commission=i})),Nh=function(){function t(){B(this,t)}return U(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=Vi("instruction").decode(t.data),r=0,i=Object.entries(Ih);r0&&void 0!==arguments[0]?arguments[0]:"voteInit";return qi([hu("nodePubkey"),hu("authorizedVoter"),hu("authorizedWithdrawer"),Wi("commission")],t)}()])},Authorize:{index:1,layout:qi([Vi("instruction"),hu("newAuthorized"),Vi("voteAuthorizationType")])},Withdraw:{index:3,layout:qi([Vi("instruction"),Gi("lamports")])},AuthorizeWithSeed:{index:10,layout:qi([Vi("instruction"),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return qi([Vi("voteAuthorizationType"),hu("currentAuthorityDerivedKeyOwnerPubkey"),fu("currentAuthorityDerivedKeySeed"),hu("newAuthorized")],t)}()])}}),Eh=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),xh=function(){function t(){B(this,t)}return U(t,null,[{key:"initializeAccount",value:function(t){var e=t.votePubkey,n=t.nodePubkey,r=t.voteInit,i=Uu(Ih.InitializeAccount,{voteInit:{nodePubkey:Zs(r.nodePubkey.toBuffer()),authorizedVoter:Zs(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Zs(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Cu,isSigner:!1,isWritable:!1},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new Iu(o)}},{key:"createAccount",value:function(t){var e=new Eu;return e.add(Ju.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}},{key:"authorize",value:function(t){var e=t.votePubkey,n=t.authorizedPubkey,r=t.newAuthorizedPubkey,i=t.voteAuthorizationType,o=Uu(Ih.Authorize,{newAuthorized:Zs(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Eu).add({keys:a,programId:this.programId,data:o})}},{key:"authorizeWithSeed",value:function(t){var e=t.currentAuthorityDerivedKeyBasePubkey,n=t.currentAuthorityDerivedKeyOwnerPubkey,r=t.currentAuthorityDerivedKeySeed,i=t.newAuthorizedPubkey,o=t.voteAuthorizationType,a=t.votePubkey,s=Uu(Ih.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Zs(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Zs(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:Tu,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new Eu).add({keys:u,programId:this.programId,data:s})}},{key:"withdraw",value:function(t){var e=t.votePubkey,n=t.authorizedWithdrawerPubkey,r=t.lamports,i=t.toPubkey,o=Uu(Ih.Withdraw,{lamports:r}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Eu).add({keys:a,programId:this.programId,data:o})}},{key:"safeWithdraw",value:function(e,n,r){if(e.lamports>n-r)throw new Error("Withdraw will leave vote account with insuffcient funds.");return t.withdraw(e)}}]),t}();xh.programId=new eu("Vote111111111111111111111111111111111111111"),xh.space=3731;var kh=new eu("Va1idator1nfo111111111111111111111111111111"),Th=To({name:xo(),website:Io(xo()),details:Io(xo()),keybaseUsername:Io(xo())}),Lh=function(){function t(e,n){B(this,t),this.key=void 0,this.info=void 0,this.key=e,this.info=n}return U(t,null,[{key:"fromConfigData",value:function(e){var n=et(e);if(2!==yu(n))return null;for(var r=[],i=0;i<2;i++){var o=new eu(n.slice(0,$s)),a=1===(n=n.slice($s)).slice(0,1)[0];n=n.slice(1),r.push({publicKey:o,isSigner:a})}if(r[0].publicKey.equals(kh)&&r[1].isSigner){var s=fu().decode(It.from(n)),u=JSON.parse(s);return fo(u,Th),new t(r[1].publicKey,u)}return null}}]),t}(),Sh=new eu("Vote111111111111111111111111111111111111111"),jh=qi([hu("nodePubkey"),hu("authorizedWithdrawer"),Wi("commission"),Hi(),Zi(qi([Hi("slot"),Vi("confirmationCount")]),Yi(Vi(),-8),"votes"),Wi("rootSlotValid"),Hi("rootSlot"),Hi(),Zi(qi([Hi("epoch"),hu("authorizedVoter")]),Yi(Vi(),-8),"authorizedVoters"),qi([Zi(qi([hu("authorizedPubkey"),Hi("epochOfLastAuthorizedSwitch"),Hi("targetEpoch")]),32,"buf"),Hi("idx"),Wi("isEmpty")],"priorVoters"),Hi(),Zi(qi([Hi("epoch"),Hi("credits"),Hi("prevCredits")]),Yi(Vi(),-8),"epochCredits"),qi([Hi("slot"),Hi("timestamp")],"lastTimestamp")]),Ch=function(){function t(e){B(this,t),this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}return U(t,null,[{key:"fromAccountData",value:function(e){var n=jh.decode(Zs(e),4),r=n.rootSlot;return n.rootSlotValid||(r=null),new t({nodePubkey:new eu(n.nodePubkey),authorizedWithdrawer:new eu(n.authorizedWithdrawer),commission:n.commission,votes:n.votes,rootSlot:r,authorizedVoters:n.authorizedVoters.map(Dh),priorVoters:zh(n.priorVoters),epochCredits:n.epochCredits,lastTimestamp:n.lastTimestamp})}}]),t}();function Dh(t){var e=t.authorizedVoter;return{epoch:t.epoch,authorizedVoter:new eu(e)}}function Oh(t){var e=t.authorizedPubkey,n=t.epochOfLastAuthorizedSwitch,r=t.targetEpoch;return{authorizedPubkey:new eu(e),epochOfLastAuthorizedSwitch:n,targetEpoch:r}}function zh(t){var e=t.buf,n=t.idx;return t.isEmpty?[]:[].concat(et(e.slice(n+1).map(Oh)),et(e.slice(0,n).map(Oh)))}var Ph={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function _h(){return(_h=_(O().mark((function t(e,n,r,i){var o,a,s,u,c,l,h;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r&&Object.prototype.hasOwnProperty.call(r,"lastValidBlockHeight")||r&&Object.prototype.hasOwnProperty.call(r,"nonceValue")?(o=r,a=i):a=r,s=a&&{skipPreflight:a.skipPreflight,preflightCommitment:a.preflightCommitment||a.commitment,minContextSlot:a.minContextSlot},t.next=4,e.sendRawTransaction(n,s);case 4:return u=t.sent,c=a&&a.commitment,l=o?e.confirmTransaction(o,c):e.confirmTransaction(u,c),t.next=9,l;case 9:if(!(h=t.sent.value).err){t.next=12;break}throw new Error("Raw transaction ".concat(u," failed (").concat(JSON.stringify(h),")"));case 12:return t.abrupt("return",u);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Bh=j(Object.freeze({__proto__:null,Account:nu,AddressLookupTableAccount:hc,AddressLookupTableInstruction:ih,AddressLookupTableProgram:oh,Authorized:mh,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:ru,BPF_LOADER_PROGRAM_ID:Ku,BpfLoader:$u,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:sh,ComputeBudgetInstruction:ah,ComputeBudgetProgram:uh,Connection:eh,Ed25519Program:lh,Enum:Xs,EpochSchedule:ac,FeeCalculatorLayout:Wu,Keypair:nh,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:rh,Loader:Xu,Lockup:gh,MAX_SEED_LENGTH:32,Message:wu,MessageAccountKeys:lu,MessageV0:bu,NONCE_ACCOUNT_LENGTH:Vu,NonceAccount:Hu,PACKET_DATA_SIZE:iu,PUBLIC_KEY_LENGTH:$s,PublicKey:eu,SIGNATURE_LENGTH_IN_BYTES:au,SOLANA_SCHEMA:Ks,STAKE_CONFIG_ID:yh,STAKE_INSTRUCTION_LAYOUTS:wh,SYSTEM_INSTRUCTION_LAYOUTS:Zu,SYSVAR_CLOCK_PUBKEY:Tu,SYSVAR_EPOCH_SCHEDULE_PUBKEY:Lu,SYSVAR_INSTRUCTIONS_PUBKEY:Su,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:ju,SYSVAR_RENT_PUBKEY:Cu,SYSVAR_REWARDS_PUBKEY:Du,SYSVAR_SLOT_HASHES_PUBKEY:Ou,SYSVAR_SLOT_HISTORY_PUBKEY:zu,SYSVAR_STAKE_HISTORY_PUBKEY:Pu,Secp256k1Program:ph,SendTransactionError:sc,SolanaJSONRPCError:uc,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:bh,StakeInstruction:vh,StakeProgram:Mh,Struct:Js,SystemInstruction:qu,SystemProgram:Ju,Transaction:Eu,TransactionExpiredBlockheightExceededError:su,TransactionExpiredNonceInvalidError:cu,TransactionExpiredTimeoutError:uu,TransactionInstruction:Iu,TransactionMessage:xu,TransactionStatus:Au,VALIDATOR_INFO_KEY:kh,VERSION_PREFIX_MASK:ou,VOTE_PROGRAM_ID:Sh,ValidatorInfo:Lh,VersionedMessage:Mu,VersionedTransaction:ku,VoteAccount:Ch,VoteAuthorizationLayout:Eh,VoteInit:Ah,VoteInstruction:Nh,VoteProgram:xh,clusterApiUrl:function(t,e){var n=!1===e?"http":"https";if(!t)return Ph[n].devnet;var r=Ph[n][t];if(!r)throw new Error("Unknown ".concat(n," cluster: ").concat(t));return r},sendAndConfirmRawTransaction:function(t,e,n,r){return _h.apply(this,arguments)},sendAndConfirmTransaction:_u})),Rh={};Object.defineProperty(Rh,"__esModule",{value:!0});var Uh={ERROR_ASSOCIATION_PORT_OUT_OF_RANGE:"ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",ERROR_FORBIDDEN_WALLET_BASE_URL:"ERROR_FORBIDDEN_WALLET_BASE_URL",ERROR_SECURE_CONTEXT_REQUIRED:"ERROR_SECURE_CONTEXT_REQUIRED",ERROR_SESSION_CLOSED:"ERROR_SESSION_CLOSED",ERROR_SESSION_TIMEOUT:"ERROR_SESSION_TIMEOUT",ERROR_WALLET_NOT_FOUND:"ERROR_WALLET_NOT_FOUND"},Qh=function(t){Y(n,t);var e=X(n);function n(){var t;B(this,n);for(var r=arguments.length,i=new Array(r),o=0;o=4294967296)throw new Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");var e=new ArrayBuffer(4);return new DataView(e).setUint32(0,t,!1),new Uint8Array(e)}function Hh(){return Wh(this,void 0,void 0,O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}function Gh(){return Wh(this,void 0,void 0,O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}var qh;function Zh(t,e){return Wh(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=JSON.stringify(t),i=Vh(t.id),o=new Uint8Array(12),crypto.getRandomValues(o),n.next=6,crypto.subtle.encrypt(Xh(i,o),e,(new TextEncoder).encode(r));case 6:return a=n.sent,(s=new Uint8Array(i.byteLength+o.byteLength+a.byteLength)).set(new Uint8Array(i),0),s.set(new Uint8Array(o),i.byteLength),s.set(new Uint8Array(a),i.byteLength+o.byteLength),n.abrupt("return",s);case 12:case"end":return n.stop()}}),n)})))}function Jh(t,e){return Wh(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s,u;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t.slice(0,4),i=t.slice(4,16),o=t.slice(16),n.next=5,crypto.subtle.decrypt(Xh(r,i),e,o);case 5:if(a=n.sent,s=Kh().decode(a),u=JSON.parse(s),!Object.hasOwnProperty.call(u,"error")){n.next=10;break}throw new Yh(u.id,u.error.code,u.error.message);case 10:return n.abrupt("return",u);case 11:case"end":return n.stop()}}),n)})))}function Xh(t,e){return{additionalData:t,iv:e,name:"AES-GCM",tagLength:128}}function Kh(){return void 0===qh&&(qh=new TextDecoder("utf-8")),qh}function $h(t,e,n){return Wh(this,void 0,void 0,O().mark((function r(){var i,o,a,s,u,c,l;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Promise.all([crypto.subtle.exportKey("raw",e),crypto.subtle.importKey("raw",t,{name:"ECDH",namedCurve:"P-256"},!1,[])]);case 2:return i=r.sent,o=tt(i,2),a=o[0],s=o[1],r.next=8,crypto.subtle.deriveBits({name:"ECDH",public:s},n,256);case 8:return u=r.sent,r.next=11,crypto.subtle.importKey("raw",u,"HKDF",!1,["deriveKey"]);case 11:return c=r.sent,r.next=14,crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(a),info:new Uint8Array},c,{name:"AES-GCM",length:128},!1,["encrypt","decrypt"]);case 14:return l=r.sent,r.abrupt("return",l);case 16:case"end":return r.stop()}}),r)})))}function td(t){if(t<49152||t>65535)throw new Qh(Uh.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE,"Association port number must be between 49152 and 65535. ".concat(t," given."),{port:t});return t}function ed(t){for(var e="",n=new Uint8Array(t),r=n.byteLength,i=0;i1?t.shift():t[0]}}(),u=1,c=0,l={__type:"disconnected"},n.abrupt("return",new Promise((function(e,n){var d,f,p,y={},m=function t(){return Wh(h,void 0,void 0,O().mark((function e(){var n,r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("connecting"===l.__type){e.next=3;break}return console.warn("Expected adapter state to be `connecting` at the moment the websocket opens. "+"Got `".concat(l.__type,"`.")),e.abrupt("return");case 3:return n=l.associationKeypair,d.removeEventListener("open",t),e.next=7,Gh();case 7:return r=e.sent,e.t0=d,e.next=11,Fh(r.publicKey,n.privateKey);case 11:e.t1=e.sent,e.t0.send.call(e.t0,e.t1),l={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:r.privateKey};case 14:case"end":return e.stop()}}),e)})))},g=function(t){t.wasClean?l={__type:"disconnected"}:n(new Qh(Uh.ERROR_SESSION_CLOSED,"The wallet session dropped unexpectedly (".concat(t.code,": ").concat(t.reason,")."),{closeEvent:t})),f()},v=function(t){return Wh(h,void 0,void 0,O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(f(),!(Date.now()-a>=ld)){t.next=5;break}n(new Qh(Uh.ERROR_SESSION_TIMEOUT,"Failed to connect to the wallet websocket on port ".concat(i,"."))),t.next=8;break;case 5:return t.next=7,new Promise((function(t){var e=s();p=window.setTimeout(t,e)}));case 7:b();case 8:case"end":return t.stop()}}),t)})))},w=function(r){return Wh(h,void 0,void 0,O().mark((function i(){var o,a,s,h,p,m,g,v;return O().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,r.data.arrayBuffer();case 2:o=i.sent,i.t0=l.__type,i.next="connected"===i.t0?6:"hello_req_sent"===i.t0?30:51;break;case 6:if(i.prev=6,a=o.slice(0,4),(s=new DataView(a).getUint32(0,!1))===c+1){i.next=11;break}throw new Error("Encrypted message has invalid sequence number");case 11:return c=s,i.next=14,Jh(o,l.sharedSecret);case 14:h=i.sent,p=y[h.id],delete y[h.id],p.resolve(h.result),i.next=29;break;case 20:if(i.prev=20,i.t1=i.catch(6),!(i.t1 instanceof Yh)){i.next=28;break}m=y[i.t1.jsonRpcMessageId],delete y[i.t1.jsonRpcMessageId],m.reject(i.t1),i.next=29;break;case 28:throw i.t1;case 29:return i.abrupt("break",51);case 30:return i.next=32,$h(o,l.associationPublicKey,l.ecdhPrivateKey);case 32:return g=i.sent,l={__type:"connected",sharedSecret:g},v=new Proxy({},{get:function(t,e){if(null==t[e]){var n=e.toString().replace(/[A-Z]/g,(function(t){return"_".concat(t.toLowerCase())})).toLowerCase();t[e]=function(t){return Wh(this,void 0,void 0,O().mark((function r(){var i;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=u++,r.t0=d,r.next=4,Zh({id:i,jsonrpc:"2.0",method:n,params:null!=t?t:{}},g);case 4:return r.t1=r.sent,r.t0.send.call(r.t0,r.t1),r.abrupt("return",new Promise((function(t,n){y[i]={resolve:function(r){switch(e){case"authorize":case"reauthorize":var i=r.wallet_uri_base;if(null!=i)try{dd(i)}catch(t){return void n(t)}}t(r)},reject:n}})));case 7:case"end":return r.stop()}}),r)})))}}return t[e]},defineProperty:function(){return!1},deleteProperty:function(){return!1}}),i.prev=35,i.t2=e,i.next=39,t(v);case 39:i.t3=i.sent,(0,i.t2)(i.t3),i.next=46;break;case 43:i.prev=43,i.t4=i.catch(35),n(i.t4);case 46:return i.prev=46,f(),d.close(),i.finish(46);case 50:return i.abrupt("break",51);case 51:case"end":return i.stop()}}),i,null,[[6,20],[35,43,46,50]])})))},b=function(){f&&f(),l={__type:"connecting",associationKeypair:r},void 0===a&&(a=Date.now()),(d=new WebSocket(o,["com.solana.mobilewalletadapter.v1"])).addEventListener("open",m),d.addEventListener("close",g),d.addEventListener("error",v),d.addEventListener("message",w),f=function(){window.clearTimeout(p),d.removeEventListener("open",m),d.removeEventListener("close",g),d.removeEventListener("error",v),d.removeEventListener("message",w)}};b()})));case 13:case"end":return n.stop()}}),n)})))};var fd=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n>>0,c=new Uint8Array(o);t[n];){var l=e[t.charCodeAt(n)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,n++}for(var f=o-i;f!==o&&0===c[f];)f++;for(var p=new Uint8Array(r+(o-f)),y=r;f!==o;)p[y++]=c[f++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var u=(o-i)*c+1>>>0,l=new Uint8Array(u);i!==o;){for(var h=e[i],d=0,f=u-1;(0!==h||d>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=u-r;p!==u&&0===l[p];)p++;for(var y=s.repeat(n);pthis.span)throw new RangeError("indeterminate span");return this.span}},{key:"replicate",value:function(t){var e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}},{key:"fromArray",value:function(t){}}]),t}();function xd(t,e){return e.property?t+"["+e.property+"]":t}Id.Layout=Ed,Id.nameWithProperty=xd,Id.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof Ed))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=function(){return new t},Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};var kd=function(t){Y(n,t);var e=X(n);function n(){return B(this,n),e.apply(this,arguments)}return U(n,[{key:"isCount",value:function(){throw new Error("ExternalLayout is abstract")}}]),n}(Ed),Td=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");return(i=e.call(this,-1,r)).elementSpan=t,i}return U(n,[{key:"isCount",value:function(){return!0}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.length-e;return Math.floor(n/this.elementSpan)}},{key:"encode",value:function(t,e,n){return 0}}]),n}(kd),Ld=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;if(B(this,n),!(t instanceof Ed))throw new TypeError("layout must be a Layout");if(void 0===r)r=0;else if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");return(o=e.call(this,t.span,i||t.property)).layout=t,o.offset=r,o}return U(n,[{key:"isCount",value:function(){return this.layout instanceof Sd||this.layout instanceof jd}},{key:"decode",value:function(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}]),n}(kd),Sd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readUIntLE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}]),n}(Ed),jd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readUIntBE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}]),n}(Ed),Cd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readIntLE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeIntLE(t,n,this.span),this.span}}]),n}(Ed),Dd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readIntBE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeIntBE(t,n,this.span),this.span}}]),n}(Ed),Od=Math.pow(2,32);function zd(t){var e=Math.floor(t/Od);return{hi32:e,lo32:t-e*Od}}function Pd(t,e){return t*Od+e}var _d=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.readUInt32LE(e);return Pd(t.readUInt32LE(e+4),n)}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=zd(t);return e.writeUInt32LE(r.lo32,n),e.writeUInt32LE(r.hi32,n+4),8}}]),n}(Ed),Bd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),Pd(t.readUInt32BE(e),t.readUInt32BE(e+4))}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=zd(t);return e.writeUInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}]),n}(Ed),Rd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.readUInt32LE(e);return Pd(t.readInt32LE(e+4),n)}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=zd(t);return e.writeUInt32LE(r.lo32,n),e.writeInt32LE(r.hi32,n+4),8}}]),n}(Ed),Ud=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),Pd(t.readInt32BE(e),t.readUInt32BE(e+4))}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=zd(t);return e.writeInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}]),n}(Ed),Qd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,4,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readFloatLE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeFloatLE(t,n),4}}]),n}(Ed),Yd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,4,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readFloatBE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeFloatBE(t,n),4}}]),n}(Ed),Wd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readDoubleLE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeDoubleLE(t,n),8}}]),n}(Ed),Fd=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,8,t)}return U(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readDoubleBE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeDoubleBE(t,n),8}}]),n}(Ed),Vd=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;if(B(this,n),!(t instanceof Ed))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof kd&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var a=-1;return!(r instanceof kd)&&0u.span&&void 0===u.property)throw new Error("fields cannot contain unnamed variable-length layout")}}catch(t){s.e(t)}finally{s.f()}var c=-1;try{c=t.reduce((function(t,e){return t+e.getSpan()}),0)}catch(t){}return(o=e.call(this,c,r)).fields=t,o.decodePrefixes=!!i,o}return U(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0;try{n=this.fields.reduce((function(n,r){var i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n,r=this.makeDestinationObject(),i=st(this.fields);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(void 0!==o.property&&(r[o.property]=o.decode(t,e)),e+=o.getSpan(t,e),this.decodePrefixes&&t.length===e)break}}catch(t){i.e(t)}finally{i.f()}return r}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r,i=n,o=0,a=0,s=st(this.fields);try{for(s.s();!(r=s.n()).done;){var u=r.value,c=u.span;if(a=0c&&(c=u.getSpan(e,n)))}o=n,n+=c}}catch(t){s.e(t)}finally{s.f()}return o+a-i}},{key:"fromArray",value:function(t){var e,n=this.makeDestinationObject(),r=st(this.fields);try{for(r.s();!(e=r.n()).done;){var i=e.value;void 0!==i.property&&0i.span?n=-1:0<=n&&(n+=i.span)}}catch(t){r.e(t)}finally{r.f()}}}]),n}(Ed),Gd=function(){function t(e){B(this,t),this.property=e}return U(t,[{key:"decode",value:function(){throw new Error("UnionDiscriminator is abstract")}},{key:"encode",value:function(){throw new Error("UnionDiscriminator is abstract")}}]),t}(),qd=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),!(t instanceof kd&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return(i=e.call(this,r||t.property||"variant")).layout=t,i}return U(n,[{key:"decode",value:function(t,e){return this.layout.decode(t,e)}},{key:"encode",value:function(t,e,n){return this.layout.encode(t,e,n)}}]),n}(Gd),Zd=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;B(this,n);var a=t instanceof Sd||t instanceof jd;if(a)t=new qd(new Ld(t));else if(t instanceof kd&&t.isCount())t=new qd(t);else if(!(t instanceof Gd))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===r&&(r=null),!(null===r||r instanceof Ed))throw new TypeError("defaultLayout must be null or a Layout");if(null!==r){if(0>r.span)throw new Error("defaultLayout must have constant span");void 0===r.property&&(r=r.replicate("content"))}var s=-1;r&&0<=(s=r.span)&&a&&(s+=t.layout.span),(o=e.call(this,s,i)).discriminator=t,o.usesPrefixDiscriminator=a,o.defaultLayout=r,o.registry={};var u=o.defaultGetSourceVariant.bind(Z(o));return o.getSourceVariant=function(t){return u(t)},o.configGetSourceVariant=function(t){u=t.bind(this)},o}return U(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}},{key:"defaultGetSourceVariant",value:function(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;var e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(var n in this.registry){var r=this.registry[n];if(t.hasOwnProperty(r.property))return r}throw new Error("unable to infer src variant")}},{key:"decode",value:function(t,e){var n;void 0===e&&(e=0);var r=this.discriminator,i=r.decode(t,e),o=this.registry[i];if(void 0===o){var a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),(n=this.makeDestinationObject())[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+a)}else n=o.decode(t,e);return n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=this.getSourceVariant(t);if(void 0===r){var i=this.discriminator,o=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=i.layout.span),i.encode(t[i.property],e,n),a+o.encode(t[o.property],e,n+a)}return r.encode(t,e,n)}},{key:"addVariant",value:function(t,e,n){var r=new Jd(this,t,e,n);return this.registry[t]=r,r}},{key:"getVariant",value:function(t,e){var n=t;return It.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}]),n}(Ed),Jd=function(t){Y(n,t);var e=X(n);function n(t,r,i,o){var a;if(B(this,n),!(t instanceof Zd))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof i&&void 0===o&&(o=i,i=null),i){if(!(i instanceof Ed))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=i.span&&i.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof o)throw new TypeError("variant must have a String property")}var s=t.span;return 0>t.span&&0<=(s=i?i.span:0)&&t.usesPrefixDiscriminator&&(s+=t.discriminator.layout.span),(a=e.call(this,s,o)).union=t,a.variant=r,a.layout=i||null,a}return U(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}},{key:"decode",value:function(t,e){var n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");var r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);var i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}},{key:"fromArray",value:function(t){if(this.layout)return this.layout.fromArray(t)}}]),n}(Ed);function Xd(t){return 0>t&&(t+=4294967296),t}var Kd=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;if(B(this,n),!(t instanceof Sd||t instanceof jd))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof r&&void 0===i&&(i=r,r=void 0),4=n)throw new TypeError("bits must be positive integer");var i=8*e.span,o=e.fields.reduce((function(t,e){return t+e.bits}),0);if(n+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=n,this.valueMask=(1<>>this.start}},{key:"encode",value:function(t){if(!Number.isInteger(t)||t!==Xd(t&this.valueMask))throw new TypeError(xd("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var e=this.container._packedGetValue(),n=Xd(t<n&&(n=this.length.decode(t,e)),n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}},{key:"encode",value:function(t,e,n){var r=this.length;if(this.length instanceof kd&&(r=t.length),!It.isBuffer(t)||r!==t.length)throw new TypeError(xd("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof kd&&this.length.encode(r,e,n),r}}]),n}(Ed),nf=function(t){Y(n,t);var e=X(n);function n(t){return B(this,n),e.call(this,-1,t)}return U(n,[{key:"getSpan",value:function(t,e){if(!It.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);for(var n=e;ne.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}]),n}(Ed),rf=function(t){Y(n,t);var e=X(n);function n(t,r){var i;if(B(this,n),"string"==typeof t&&void 0===r&&(r=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");return(i=e.call(this,-1,r)).maxSpan=t,i}return U(n,[{key:"getSpan",value:function(t,e){if(!It.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}},{key:"decode",value:function(t,e,n){void 0===e&&(e=0);var r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}]),n}(Ed),of=function(t){Y(n,t);var e=X(n);function n(t,r){var i;return B(this,n),(i=e.call(this,0,r)).value=t,i}return U(n,[{key:"decode",value:function(t,e,n){return this.value}},{key:"encode",value:function(t,e,n){return 0}}]),n}(Ed);Id.ExternalLayout=kd,Id.GreedyCount=Td,Id.OffsetLayout=Ld,Id.UInt=Sd,Id.UIntBE=jd,Id.Int=Cd,Id.IntBE=Dd,Id.Float=Qd,Id.FloatBE=Yd,Id.Double=Wd,Id.DoubleBE=Fd,Id.Sequence=Vd,Id.Structure=Hd,Id.UnionDiscriminator=Gd,Id.UnionLayoutDiscriminator=qd,Id.Union=Zd,Id.VariantLayout=Jd,Id.BitStructure=Kd,Id.BitField=$d,Id.Boolean=tf,Id.Blob=ef,Id.CString=nf,Id.UTF8=rf,Id.Constant=of,Id.greedy=function(t,e){return new Td(t,e)},Id.offset=function(t,e,n){return new Ld(t,e,n)},Id.u8=function(t){return new Sd(1,t)},Id.u16=function(t){return new Sd(2,t)},Id.u24=function(t){return new Sd(3,t)},Id.u32=function(t){return new Sd(4,t)},Id.u40=function(t){return new Sd(5,t)},Id.u48=function(t){return new Sd(6,t)},Id.nu64=function(t){return new _d(t)},Id.u16be=function(t){return new jd(2,t)},Id.u24be=function(t){return new jd(3,t)},Id.u32be=function(t){return new jd(4,t)},Id.u40be=function(t){return new jd(5,t)},Id.u48be=function(t){return new jd(6,t)},Id.nu64be=function(t){return new Bd(t)},Id.s8=function(t){return new Cd(1,t)},Id.s16=function(t){return new Cd(2,t)},Id.s24=function(t){return new Cd(3,t)},Id.s32=function(t){return new Cd(4,t)},Id.s40=function(t){return new Cd(5,t)},Id.s48=function(t){return new Cd(6,t)},Id.ns64=function(t){return new Rd(t)},Id.s16be=function(t){return new Dd(2,t)},Id.s24be=function(t){return new Dd(3,t)},Id.s32be=function(t){return new Dd(4,t)},Id.s40be=function(t){return new Dd(5,t)},Id.s48be=function(t){return new Dd(6,t)},Id.ns64be=function(t){return new Ud(t)},Id.f32=function(t){return new Qd(t)},Id.f32be=function(t){return new Yd(t)},Id.f64=function(t){return new Wd(t)},Id.f64be=function(t){return new Fd(t)},Id.struct=function(t,e,n){return new Hd(t,e,n)},Id.bits=function(t,e,n){return new Kd(t,e,n)};var af=Id.seq=function(t,e,n){return new Vd(t,e,n)};Id.union=function(t,e,n){return new Zd(t,e,n)},Id.unionLayoutDiscriminator=function(t,e){return new qd(t,e)},Id.blob=function(t,e){return new ef(t,e)},Id.cstr=function(t){return new nf(t)},Id.utf8=function(t,e){return new rf(t,e)},Id.const=function(t,e){return new of(t,e)};var sf={},uf={exports:{}};!function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"===z(t)?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:cr.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"===z(t))return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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];i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.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;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 I(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){I.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return v[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,I),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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,L)}(uf),function(t){var e=L&&L.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;var n=Id,r=Bh,i=e(uf.exports),o=Id;Object.defineProperty(t,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(t,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(t,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(t,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(t,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(t,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(t,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(t,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return o.struct}});var a=function(t){Y(r,t);var e=X(r);function r(t,i,o){var a;return B(this,r),(a=e.call(this,t,o)).blob=n.blob(t),a.signed=i,a}return U(r,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new i.default(this.blob.decode(t,e),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.signed&&(t=t.toTwos(8*this.span)),this.blob.encode(t.toArrayLike(It,"le",this.span),e,n)}}]),r}(n.Layout);function s(t){return new a(8,!1,t)}t.u64=s,t.i64=function(t){return new a(8,!0,t)},t.u128=function(t){return new a(16,!1,t)},t.i128=function(t){return new a(16,!0,t)};var u=function(t){Y(n,t);var e=X(n);function n(t,r,i,o){var a;return B(this,n),(a=e.call(this,t.span,o)).layout=t,a.decoder=r,a.encoder=i,a}return U(n,[{key:"decode",value:function(t,e){return this.decoder(this.layout.decode(t,e))}},{key:"encode",value:function(t,e,n){return this.layout.encode(this.encoder(t),e,n)}},{key:"getSpan",value:function(t,e){return this.layout.getSpan(t,e)}}]),n}(n.Layout);t.publicKey=function(t){return new u(n.blob(32),(function(t){return new r.PublicKey(t)}),(function(t){return t.toBuffer()}),t)};var c=function(t){Y(r,t);var e=X(r);function r(t,i){var o;return B(this,r),(o=e.call(this,-1,i)).layout=t,o.discriminator=n.u8(),o}return U(r,[{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==t?this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+1)+1)}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+1);throw new Error("Invalid option "+this.property)}},{key:"getSpan",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(t,e);if(0===n)return 1;if(1===n)return this.layout.getSpan(t,e+1)+1;throw new Error("Invalid option "+this.property)}}]),r}(n.Layout);function l(t){if(0===t)return!1;if(1===t)return!0;throw new Error("Invalid bool: "+t)}function h(t){return t?1:0}function d(t){var e=n.u32("length"),r=n.struct([e,n.blob(n.offset(e,-e.span),"data")]);return new u(r,(function(t){return t.data}),(function(t){return{data:t}}),t)}t.option=function(t,e){return new c(t,e)},t.bool=function(t){return new u(n.u8(),l,h,t)},t.vec=function(t,e){var r=n.u32("length"),i=n.struct([r,n.seq(t,n.offset(r,-r.span),"values")]);return new u(i,(function(t){return t.values}),(function(t){return{values:t}}),e)},t.tagged=function(t,e,r){var i=n.struct([s("tag"),e.replicate("data")]);return new u(i,(function(e){var n=e.tag,r=e.data;if(!n.eq(t))throw new Error("Invalid tag, expected: "+t.toString("hex")+", got: "+n.toString("hex"));return r}),(function(e){return{tag:t,data:e}}),r)},t.vecU8=d,t.str=function(t){return new u(d(),(function(t){return t.toString("utf-8")}),(function(t){return It.from(t,"utf-8")}),t)},t.rustEnum=function(t,e,r){var i=n.union(null!=r?r:n.u8(),e);return t.forEach((function(t,e){return i.addVariant(e,t,t.property)})),i},t.array=function(t,e,r){var i=n.struct([n.seq(t,e,"values")]);return new u(i,(function(t){return t.values}),(function(t){return{values:t}}),r)};var f=function(t){Y(n,t);var e=X(n);function n(t,r,i){var o;return B(this,n),(o=e.call(this,t.span+r.span,i)).keyLayout=t,o.valueLayout=r,o}return U(n,[{key:"decode",value:function(t,e){return e=e||0,[this.keyLayout.decode(t,e),this.valueLayout.decode(t,e+this.keyLayout.getSpan(t,e))]}},{key:"encode",value:function(t,e,n){n=n||0;var r=this.keyLayout.encode(t[0],e,n);return r+this.valueLayout.encode(t[1],e,n+r)}},{key:"getSpan",value:function(t,e){return this.keyLayout.getSpan(t,e)+this.valueLayout.getSpan(t,e)}}]),n}(n.Layout);t.map=function(t,e,r){var i=n.u32("length"),o=n.struct([i,n.seq(new f(t,e),n.offset(i,-i.span),"values")]);return new u(o,(function(t){var e=t.values;return new Map(e)}),(function(t){return{values:Array.from(t.entries())}}),r)}}(sf),ut.Web3MobileWallet;var cf=ut.transact,lf=cr.Buffer,hf=Mr.exports,df=sf.struct([sf.publicKey("mint"),sf.publicKey("owner"),sf.u64("amount"),sf.u32("delegateOption"),sf.publicKey("delegate"),sf.u8("state"),sf.u32("isNativeOption"),sf.u64("isNative"),sf.u64("delegatedAmount"),sf.u32("closeAuthorityOption"),sf.publicKey("closeAuthority")]);sf.array;var ff=sf.bool,pf=sf.i128;sf.i16;var yf=sf.i32,mf=sf.i64;sf.i8,sf.map;var gf=sf.option,vf=sf.publicKey,wf=sf.rustEnum,bf=sf.str,Mf=sf.struct;sf.tagged;var Af=sf.u128,Nf=sf.u16,If=sf.u32,Ef=sf.u64,xf=sf.u8,kf=sf.vec;sf.vecU8;const Tf="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yOTkuMyAyMzcuNSA1MDAgMTIybDIwMC43IDExNS41LTczLjUgNDIuNkw1MDAgMjA4LjJsLTEyNy4xIDcxLjktNzMuNi00Mi42em00MDEuNCAxNDYtNzMuNS00Mi42LTEyNy4xIDczTDM3MyAzNDAuNGwtNzMuNSA0My4xdjg1LjdsMTI3LjEgNzN2MTQ1LjRsNzMuNSA0My4xIDczLjUtNDMuMVY1NDIuMWwxMjcuMS03M3YtODUuNnptMCAyMzIuMXYtODUuN2wtNzMuNSA0Mi42djg1LjdjLS4xLS42IDczLjUtNDIuNiA3My41LTQyLjZ6bTUxLjkgMjkuMy0xMjcuMSA3M3Y4NS43TDgyNi4xIDY4OFY0NTYuNGwtNzMuNSA0My4xdjE0NS40em0tNzMuNS0zMzQuNCA3My41IDQzLjF2ODUuN2w3My41LTQzLjF2LTg1LjdsLTczLjUtNDMuMS03My41IDQzLjF6TTQyNi41IDc0OS40djg1LjdsNzMuNSA0My4xIDczLjUtNDMuMXYtODUuN2wtNzMuNSA0Mi03My41LTQyek0yOTkuMyA2MTUuNmw3My41IDQzLjF2LTg2LjJMMjk5LjMgNTMwdjg1LjZ6bTEyNy4yLTMwNS4xIDczLjUgNDMuMSA3My41LTQzLjEtNzMuNS00Mi42YzAtLjUtNzMuNSA0Mi42LTczLjUgNDIuNnptLTE3OS4xIDQzLjEgNzMuNS00My4xLTczLjUtNDMuMS03My41IDQzLjF2ODUuN2w3My41IDQzLjF2LTg1Ljd6bTAgMTQ1LjQtNzMuNS00Mi42VjY4OGwyMDAuNyAxMTUuNXYtODUuN2wtMTI3LjEtNzNjLS4xLjEtLjEtMTQ1LjgtLjEtMTQ1Ljh6IiBmaWxsPSIjZjBiOTBiIi8+PC9zdmc+",Lf="https://app.uniswap.org/static/media/bnb-logo.797868eb94521320b78e3967134febbe.svg";var Sf={name:"bsc",id:"0x38",networkId:"56",namespace:"eip155",platform:"evm",label:"BNB Smart Chain",fullName:"BNB Smart Chain Mainnet",logo:Tf,logoBackgroundColor:"#000000",logoWhiteBackground:Tf,currency:{name:"BNB",symbol:"BNB",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Lf},wrapped:{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png"},stables:{usd:["0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d","0x55d398326f99059fF775485246999027B3197955"]},explorer:"https://bscscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://bscscan.com/tx/${t.id||t}`:e?`https://bscscan.com/token/${e}`:n?`https://bscscan.com/address/${n}`:void 0,endpoints:["https://bsc-dataseed.binance.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed3.defibit.io"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"BNB",name:"Binance Coin",decimals:18,logo:Lf,type:"NATIVE"},{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",symbol:"WBNB",name:"Wrapped BNB",decimals:18,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png",type:"20"},{address:"0x55d398326f99059fF775485246999027B3197955",symbol:"USDT",name:"Tether USD",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x55d398326f99059fF775485246999027B3197955/logo.png",type:"20"},{address:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",symbol:"USDC",name:"USD Coin",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d/logo.png",type:"20"},{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:"ETH",name:"Ethereum Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x2170Ed0880ac9A755fd29B2688956BD959F933F8/logo.png",type:"20"},{address:"0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",symbol:"Cake",name:"PancakeSwap Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82/logo.png",type:"20"},{address:"0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",symbol:"BTCB",name:"BTCB Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const jf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAADxdJREFUeJztXVtzFMcVplwuP8VVeYmf7HJ+RKqSl/AQP6X8H+yqXUEIjhMnQY5jO9oVCIzA5mowdzAYG4xAGAyWLC5G3IyDL8gOASUYKrarYGZWC7qi23b6692VV6uZ7e6ZnT3di07VV6JUaLfnnG+6z+lz+vScOXUoL6SzP52/2PtlQ9p7piHlLU2k3P2JJqcjkXLO8589/OdN/tPjvx8VEP8Wv+sp/J8O/A3+Fp+Bz8JnUj/XrPjIwjT7ybxm57fJlLsy2eR2cwPe4QZksYB/Nr4D34XvxHdTP/8DJ+k0e4S/lb9Jpr2WZJNzgRtjPDaDS4DvFmPgY8GYMDZq/dStNKQzv0qmnA1c6RkqgysQIoMxYqzU+qoLWZDO/jyZdl7lir1ObdwQZLiOseMZqPVonSTS7i+4AtsTTW6O2pDR4ebEs/Bnotar8dKw2Pk1n0I76Y0W16zgdOIZqfVsnCSbvaeEB2+AkWpCBEQS/Jmp9U4u3Fl6nIdWB6gNQgb+7NABtR1qLjxcejiZdhfxKXGA3AjUswHXAXQBnVDbpSbCPeO5fAr8hlrxpgE6gW6o7ROb5N96Z3l9ePZxgUcMXEd1NxssbMk8kWxyztEr2A5AV3XjGySb3acTSLYYoFjL4EF31PYLLXwaeyiZcltnp/woEJtIrdAltT21BEkR7tnuo1dgfQC6tCbRlGh1H02k3C5qpalg/bt3WdOGDPk4lACdct1S27eiLEgPPMbDmcvkylLAgiUOc/sm2LHuITavmX48KoBun1828DNqO/tKsiX7JF+zeqmVpIqPzg2xyckc++Sfw2ImoB6POtxe6Jra3tMEb75Nxv/Hmxk2MZGbIsCpz4bZn1d45OPSIQF0Tm13IViXbJn2i+i9NcYgRQIA+zsGyMelA6Fzap8AnqktDl8RO9r7WVFKCQAs3dJHPj4tcN2TRQcizrcs1Hv+NZf1D04GEqDj/JBwDqnHqYNCiFj7fYL8Jg+9AnTQfXmYlUo5AYAtbffIx6lNAm6L2hpfbO/atcO3dGsfy+VyUgIAL66yySEE3FzNto2R2ElYtrffkHbYd7fHWbkEEeDQyUHk6cnHrQkPtonV+CKla2FWDx6+nwQRAFi5K0s+bl3ANrGmkvP5fPoH1cFfX/fYyP2cNgG6Lg6z55a55OPXJgG3UVzGn2vbug98fvW+r/FlBADePtJPPn59iKKS6lYW5ad++8q4Vu+5G2h8FQIAr663JFlUAtiqqksBZ1Uj9UPp4neLHeb0TUQmwNEzg2xemv559OE2VsX4KE2ysXoXhpOJCgGAdXttShblAZtVpayMe5Zt1A+ji5fXZdj4uL/jF4YApy4NsxdaLXQIue2iGb/Ze4r6IcLg6rejUuPrEAB47yO7kkVTJIhyAsnG41rYylUVHQIAizdZlixqyh9DC2V8HGKkHrwuELffHZiUWz4kAVBEAueS+jl1EepAqo2ndLFW64guAYBNB2xMFjmdWsbHWXbqQesC0zMMGjcBgEVv2JYs4tDpT5BvzmDAoBWBxM2tH8a0jB+FAAe77EsWwaZKxkdLE9u2fPce65dbu4oEAFp32JYscnNK7WrQ14Z+sOpAMefwiLrjVy0CdF0cYguX2rU3ANtKCWBTdS9wqWcklPGjEgDYcdiuZBEaV1U0PtqbUQ9SB6/vyoY2fjUIALy81q5kUcUWduhxRz1AVcxvdthtb2aVT60JcOT0oKg4otaHKmBjX+OLA50GN2Esx+FT8mRPLQgAIO1MrQ91ArgZ31JytDqlHpwqXlrjsbExvZg/TgKcvDTM/rjcHocQtp45/ae9FuqBqeLr/6gle2pFAAChKLVeVAFbzyRAk3OBemAq2LhfPdlTSwIA6Y12JItg62nGR9tzyq7bqljY4rK+e5WrfCgJcPzskHBOqfUkJQC39bRW9+h9Tz0oFXx8Yahqxo+DAMCGfXY4hLB5SfjnrqQekAypjRntZA8FAU5/NixK0an1JQNsXrL+m1/4ceM7/WRPJcExsas3Rtn7nQNVJ8GBj82vHppWKBLrNStVAOrzqyWjPHzEWQGEbjBW81t9bPn2LNt9tF/UE1SLBMu2Ge4QcpsL4+MyJPLBVADi68HhcMmeUrnbP8kufDUyw8ggQBHoD7Dt4D3WyX2NqASAv/L7Fnr9VYK4CAs3YlEPpBLOfxk+2QP5wRlnZy7ztTnAUKUEKGLJpj72JnfmUFoehQTbDpldPQTb8/Xfe5Z6IEHA1BxWem+N8rdd/ib7EaAUq/dkxZoelgTYtaTWYxBwJR7y/8uoB+IHnMbB26sjY+M59uU1vr5/qj6FywhQxIodWfbOh/2ioZQOAZCzMLV6CLafU7hUkXww5Wjr8j/S7Sdo+3LxyojSGx+WAFN+wtY+tp1P7V0afsIbbxtaPcRtb2T1b+Mqj90flcf8t91x1v158PoeBwGKWLy5j23kfsIxBT/h5KfDoj8RtV7LIaqFTcwBfHUt+Eg35L//G2WnqxSyhSVAKdZwP+FgV2U/Yc9R85JFIieQwH25BgymCHTt9JPxiRy7ch3xe/QQrdoEKGLlzqzICgb5CQb2Je6ZU7g0mXogAmjR5mWnJ3uwB3Dp65nxu4kEKGIZ9xN2tN9jJy5OJ6txfYm57TEDGNPwCdm0otzJTLCzX+T31uMwfJwEmNpP2NLHNu2/y453/0gEw/oSe3MK16dTD2Sqf+/N78diN3qtCDDlMG7qY2v33mWHTg6Y1ZeY294YAhw7Ozi1P19L1IIA0/yEXdxpfMeQWUAQwJAlAClUtHOrdwL8fW3GpBPGnlFOIIDp8lh3dT19EwiAJe4PprWdKziBRoWBALaB1/JpEhsothMAdYJY8w3dDhZh4HkDBuIL7J7t+qDfWgKg57BRYV85uO0xA3SQD0SCl9ZkRP9eWwjwyrqM8bUABXQYkwySpU0xhb62Lcs6z5u7E4idPpUDIn8ypeOYSAYZkg5esTPLPr0yIu2+gd1CnA3QTcvGSYA0B6IY2TpfXNLQxo5a30BDyluKI2HPUA+kCHj/qNlDDl0WKsGxevd49LAxqvGxPM2XjBV+AJpNYp/DpJ1AURBiUkkYvP9i9S9yAnjTZX+DaffoJ+H9g7CGR1j3nEKDCIS12OLGd6HGwaRoQJSEmVYU+rfVHhu+/2MR6LWbo+JMQGUmO6Lo4kSIsDFMWKfSNRRLWWnJOdrPm3aAVBSFmlgWXt7sEQc4kB+QKRBv5Pb2e7ERAIUqssbROL629eDMMSzZbFiZeLEs3NSDISjhLpeh4Umx7ssaMiD+bpMUaOgQAE6b7DYxjAkdS7ouzoxScFUdtT7LMe1giIlHw/AmORn/g6AoFlWps0OdP7p7hiUA/AuVUi74A+gU4vf5KC2XOYkkBCg9Gmbq4VBMm0gRBwkqgGX7B1A+PO+ggpKgsO4vK+VhHXwBVAAFkQuhqqk3kE07HGry8XDU5FcStIWHl40Zo9LnwH9AXZ6MAHBCZUe8EaLiFLBsL2LVbjOrgWccDze5QQTeQpX27zj6tV3hJM4r6zPsg5Lpemr7lv9eRiIA5V4dCruR+wxuLz+jQYTpLWIwHQ8MqZ0P/Pb7MdYiuQMYpMLOI87vIcRU2ZrFUnPwhNp+A7arTb5xzLdFjOlNorCTpio4+o0zhSBOpc+EZy+LKJDD33lYLyNpYPXvNPg2ibKhTRzqA3QE9wUiHAzTtgXx/po9+jUJpreTD2wTlw8HzW4UCY/e7wpYmSCc1NmDRxQQpioJOQzTbxgLbBSZXwbMbxWLmDtsj8B/3RiteA8gMnr7QtYlItEjW3JMQMVWsflZwL1OPUgZEM6FFWwrI2dQWp+H4o3NB/S2kMuBo+zUepFB2ixaEMCSdvFf/Lvy+UGZIKpAW5hiNBDF+Cae+/MlgEq7eFsujMAWbdSegdXoEoZNKFmewAwoXhhRWAasuDIGTRuitI57kNrFK18ZA7Hp0qgPz4RvHhmVACZV90ihc2lUfhYwr3GEHxrS4XsIRiEAchQmVfdUgva1cRCbLo58sayKKG4CIOdvWnVPxZckzMWRYhYwsFAkCDpXxkYlgHHVPRUQ+upYQQDLLo/W7SkYhgAoOaN+Ti0CRLk8GpJIOQeoH0IVSOfeCagiqgYBUH1sYnVPILjtIhkf0pDOPM6diAHyh1EEpufxClVEYQmA4o9Gi66Mhc1gu8gEgCTT7iLqB9KBrIooDAGM7fUXRABus6oYH5JOs4e5M/EN9UNpsF+0gq8WAd4zuLrH9/m5rWCzqhEAkkw7c23YIi4CmTl0EI1KAFHdY9UVsW4Otqqq8UtIsJz+AdWBJhNRCYD0M/Vz6AA2isX4kPxS4JyjfkgdVKoikhHgrfctC/m4bao+9ZfLwpbMEwlDGkupoFIVUSUCtJ80v7qnDB5sE6vxi5Jsdp+2yR9AFdCoTxVREAEwaxjTy08JfN3nNqmJ8adIkHJb6R9cHbt9qoiCCIBOJNTj1QFsUVPjQ/ha8xCPNfdRP7wOcFmUjAC7j9hR3TNlfG4D2KLmBCiQ4JFEyu2iVoIqyquIyglgT3VPAVz3gSXetZJEq/tossm9TK4MRbSWVBGVEwDtXqjHpwqhc657UuMXZUF64DHuiPRSK0UVOLJdTgCcPKIelzrcXuic2u7TJNmSfdIWEhSriIoEsKm6BzqGrqnt7StgpS3LAc7to+MIqntMvM/HD9CtcW9+uWBdssUxxDk+dPGiHocSoFNT1nyZiIOmloWIJqMQ6tF6+7oi9gnEZpE9O4bmwc1Bh2RxfjUkv21sT+7AIHg1396NS5CksC2LSAnoqmaJnVqJSCWLeoLZJSEYophjeewpXUpBtYpN5WW1AnQSWyWPaQKGc7Y32lRtHJvhhQ7cxrp+64NElJw3OW3URqB76522qpVu2yw4vWLTMbTohne7I5/YqUfBIUZbTiWHMjx/ttAHNR8kwVn2fJOKeogYxGZOu/b5/FnJt6vJ9yyyI8tYZvhejF25LcusVBa0N0OPO5ObWWJsGKO0FdushBckRdDqFP1u0fSYsss5vluMgY8FY7IuYVMPgrbn6H2PCxBEJBHn9Tf8s4UHz78L3zmj5fqsmCG4DAk3YiWbvGfFvYgpdz888EJL/J7Chdkerk8XEP8Wv+vJzyo8EsHf8L/FZ+Czpi5YqjP5P2ey0rAsl+yGAAAAAElFTkSuQmCC",Cf="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png";var Df={name:"ethereum",id:"0x1",networkId:"1",namespace:"eip155",platform:"evm",label:"Ethereum",fullName:"Ethereum Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbC1vcGFjaXR5Oi42MDJ9LnN0MCwuc3Qxe2ZpbGw6I2ZmZn08L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik01MTEuNCA3My4zdjMxNS41TDc3OCA1MDggNTExLjQgNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNTExLjQgNzMuMyAyNDQuNyA1MDhsMjY2LjYtMTE5LjJWNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNNTExLjQgNzEyLjN2MjE0LjVsMjY2LjgtMzY5LjEtMjY2LjggMTU0LjZ6Ii8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTUxMS40IDkyNi43VjcxMi4zTDI0NC43IDU1Ny42bDI2Ni43IDM2OS4xeiIvPjxwYXRoIGQ9Ik01MTEuNCA2NjIuNyA3NzggNTA4IDUxMS40IDM4OC44djI3My45eiIgZmlsbD0iI2ZmZiIgZmlsbC1vcGFjaXR5PSIuMiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im0yNDQuNyA1MDggMjY2LjYgMTU0LjdWMzg4LjhMMjQ0LjcgNTA4eiIvPjwvc3ZnPgo=",logoBackgroundColor:"#5683ec",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGltYWdlLXJlbmRlcmluZz0ib3B0aW1pemVRdWFsaXR5IiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgdGV4dC1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4PSIwIiB5PSIwIiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGU+LnN0MXtmaWxsOiM4YzhjOGN9PC9zdHlsZT48cGF0aCBkPSJtNDk5LjggNzcuNS01LjUgMTl2NTU5LjFsNS41IDUuNSAyNTkuNy0xNTMuNUw0OTkuOCA3Ny41eiIgZmlsbD0iIzM0MzQzNCIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Im00OTkuOCA3Ny41LTI1OS4zIDQzMEw0OTkuOCA2NjFWNzcuNXoiLz48cGF0aCBkPSJtNDk5LjggNzEwLjMtMi45IDR2MTk5LjFsMi45IDkuMSAyNTkuNy0zNjUuOC0yNTkuNyAxNTMuNnoiIGZpbGw9IiMzYzNjM2IiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNDk5LjggOTIyLjVWNzEwLjNMMjQwLjUgNTU2LjdsMjU5LjMgMzY1Ljh6Ii8+PHBhdGggZD0ibTQ5OS44IDY2MSAyNTkuNy0xNTMuNS0yNTkuNy0xMTcuOFY2NjF6IiBmaWxsPSIjMTQxNDE0Ii8+PHBhdGggZD0iTTI0MC41IDUwNy41IDQ5OS44IDY2MVYzODkuN0wyNDAuNSA1MDcuNXoiIGZpbGw9IiMzOTM5MzkiLz48L3N2Zz4K",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:jf},wrapped:{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",logo:Cf,logoBackgroundColor:"#FFFFFF"},stables:{usd:["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]},explorer:"https://etherscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://etherscan.io/tx/${t.id||t}`:e?`https://etherscan.io/token/${e}`:n?`https://etherscan.io/address/${n}`:void 0,endpoints:["https://rpc.ankr.com/eth","https://eth.llamarpc.com","https://ethereum.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:jf,type:"NATIVE"},{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:Cf,type:"20"},{address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c/logo.png",type:"20"},{address:"0xdAC17F958D2ee523a2206206994597C13D831ec7",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x6B175474E89094C44Da98b954EedeAC495271d0F",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x853d955aCEf822Db058eb8505911ED77F175b99e",symbol:"FRAX",name:"Frax",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x853d955aCEf822Db058eb8505911ED77F175b99e/logo.png",type:"20"},{address:"0x956F47F50A910163D8BF957Cf5846D573E7f87CA",symbol:"FEI",name:"Fei USD",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x956F47F50A910163D8BF957Cf5846D573E7f87CA/logo.png",type:"20"},{address:"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Of="https://assets.spooky.fi/tokens/FTM.png",zf="https://assets.spooky.fi/tokens/wFTM.png";var Pf={name:"fantom",id:"0xfa",networkId:"250",namespace:"eip155",label:"Fantom",fullName:"Fantom Opera",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00NjcgMTM1LjVjMTgtOS4zIDQ1LjEtOS4zIDYzIDBsMTgzLjQgOTdjMTAuNyA2LjEgMTYuNiAxNCAxOCAyMy4zdjQ4Ni42YzAgOS4zLTYuMSAxOS4yLTE4IDI1LjJsLTE4My4yIDk3Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTgzLjMtOTdjLTExLjktNi4xLTE3LjItMTUuOS0xOC0yNS4yVjI1NS43Yy43LTguNyA2LjctMTcuMiAxNy4yLTIzLjNMNDY3IDEzNS41em0yMzUuOCAzODkuNy0xNzIuNiA5MC45Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTcxLjktOTAuM3YyMTQuNGwxNzEuOSA5MC4zYzEwIDUuMyAyMC42IDEwLjcgMzEuMiAxMS4zaC43YzEwIDAgMjAtNS4zIDMwLjUtMTBsMTc0LTkyLjMtLjgtMjE0LjN6TTIzNy4zIDczMS4xYzAgMTguNiAyIDMxLjIgNi43IDM5LjggMy4zIDcuMyA4LjcgMTIuNiAxOC42IDE5LjJsLjcuN2MyIDEuNCA0LjcgMi42IDcuMyA0LjdsMy4zIDIgMTAuNyA2LjEtMTQuNiAyNC42LTExLjMtNy4zLTItMS40Yy0zLjMtMi02LjEtNC04LjctNS4zLTI3LjktMTguNi0zNy44LTM5LjItMzcuOC04MS42di0xLjRoMjcuMXpNNDg1IDM5Ni40Yy0xLjQuNy0yLjYuNy00IDEuNGwtMTgzLjIgOTYuOWgtLjcuN2wxODMuMyA5N2MxLjQuNyAyLjYgMS40IDQgMS40bC0uMS0xOTYuN3ptMjkuMyAwdjE5Ny44YzEuNC0uNyAyLjYtLjcgNC0xLjRsMTgzLjMtOTdoLjctLjdsLTE4My4zLTk4LjJjLTEuNC0uNS0yLjgtMS4yLTQtMS4yem0xODguNS0xMDctMTY0LjcgODYuMyAxNjQuNyA4Ni40VjI4OS40em0tNDA3LjcgMHYxNzMuM2wxNjQuNy04Ni4zLTE2NC43LTg3em0yMjIuNS0xMjhjLTkuMy01LjMtMjYuNS01LjMtMzYuNiAwbC0xODMuMiA5N2gtLjcuN2wxODMuMyA5N2M5LjMgNS4zIDI2LjUgNS4zIDM2LjYgMGwxODMuMy05N2guNy0uN2wtMTgzLjQtOTd6bTIxMi41IDkuMyAxMS4zIDcuMyAyIDEuNGMzLjMgMiA2LjEgNCA4LjcgNS4zIDI3LjkgMTguNiAzNy44IDM5LjIgMzcuOCA4MS42djEuNGgtMjguN2MwLTE4LjYtMi0zMS4yLTYuNy0zOS44LTMuMy03LjMtOC43LTEyLjYtMTguNi0xOS4ybC0uNy0uN2MtMi0xLjQtNC43LTIuNi03LjMtNC43bC0zLjMtMi0xMC43LTYuMSAxNi4yLTI0LjV6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#226efb",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iNDI1IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE5NjlmZiIvPjxwYXRoIGQ9Ik00NzQuMSAyMTAuM2MxNC4zLTcuNCAzNS45LTcuNCA1MC4yIDBsMTQ1LjkgNzcuMmM4LjUgNC44IDEzLjIgMTEuMSAxNC4zIDE4LjV2Mzg3LjVjMCA3LjQtNC44IDE1LjMtMTQuMyAyMC4xbC0xNDUuOSA3Ny4yYy0xNC4zIDcuNC0zNS45IDcuNC01MC4yIDBsLTE0NS45LTc3LjJjLTkuNS00LjgtMTMuNy0xMi43LTE0LjMtMjAuMVYzMDZjLjUtNi45IDUuMy0xMy43IDEzLjctMTguNS4xIDAgMTQ2LjUtNzcuMiAxNDYuNS03Ny4yem0xODcuNyAzMTAuM0w1MjQuMyA1OTNjLTE0LjMgNy40LTM1LjkgNy40LTUwLjIgMGwtMTM2LjktNzEuOXYxNzAuN2wxMzYuOSA3MS45YzcuOSA0LjIgMTYuNCA4LjUgMjQuOCA5aC41YzcuOSAwIDE1LjktNC4yIDI0LjMtNy45bDEzOC41LTczLjVWNTIwLjZoLS40ek0yOTEuMiA2ODQuNWMwIDE0LjggMS42IDI0LjggNS4zIDMxLjcgMi42IDUuOCA2LjkgMTAgMTQuOCAxNS4zbC41LjVjMS42IDEuMSAzLjcgMi4xIDUuOCAzLjdsMi42IDEuNiA4LjUgNC44LTExLjYgMTkuNi05LTUuOC0xLjYtMS4xYy0yLjYtMS42LTQuOC0zLjItNi45LTQuMi0yMi4yLTE0LjgtMzAuMS0zMS4yLTMwLjEtNjV2LTEuMWgyMS43em0xOTcuMi0yNjYuNGMtMS4xLjUtMi4xLjUtMy4yIDEuMWwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzEuMS41IDIuMSAxLjEgMy4yIDEuMVY0MTguMXptMjMuMiAwdjE1Ny41YzEuMS0uNSAyLjEtLjUgMy4yLTEuMWwxNDUuOS03Ny4yaC41LS41bC0xNDUuOS03OC4yYy0xLjEtLjUtMi4xLTEtMy4yLTF6TTY2MS44IDMzM2wtMTMxLjEgNjguNyAxMzEuMSA2OC43VjMzM3ptLTMyNC42IDB2MTM4bDEzMS4xLTY4LjdjMC0uMS0xMzEuMS02OS4zLTEzMS4xLTY5LjN6bTE3Ny4xLTEwMi4xYy03LjQtNC4yLTIxLjEtNC4yLTI5LjEgMGwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzcuNCA0LjIgMjEuMSA0LjIgMjkuMSAwbDE0NS45LTc3LjJoLjUtLjVsLTE0NS45LTc3LjJ6bTE2OS4xIDcuNCA5IDUuOCAxLjYgMS4xYzIuNiAxLjYgNC44IDMuMiA2LjkgNC4yIDIyLjIgMTQuOCAzMC4xIDMxLjIgMzAuMSA2NXYxLjFoLTIyLjdjMC0xNC44LTEuNi0yNC44LTUuMy0zMS43LTIuNi01LjgtNi45LTEwLTE0LjgtMTUuM2wtLjUtLjVjLTEuNi0xLjEtMy43LTIuMS01LjgtMy43bC0yLjYtMS42LTguNS00LjggMTIuNi0xOS42eiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",currency:{name:"Fantom",symbol:"FTM",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Of},wrapped:{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",logo:zf},stables:{usd:["0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf","0x1B6382DBDEa11d97f24495C9A90b7c88469134a4"]},explorer:"https://ftmscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://ftmscan.com/tx/${t.id||t}`:e?`https://ftmscan.com/token/${e}`:n?`https://ftmscan.com/address/${n}`:void 0,endpoints:["https://rpc.ftm.tools","https://fantom.publicnode.com","https://rpc2.fantom.network"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"FTM",name:"Fantom",decimals:18,logo:Of,type:"NATIVE"},{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",symbol:"WFTM",name:"Wrapped Fantom",decimals:18,logo:zf,type:"20"},{address:"0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf",symbol:"lzUSDC",name:"LayerZero USDC",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"},{address:"0x1B6382DBDEa11d97f24495C9A90b7c88469134a4",symbol:"axlUSDC",name:"Axelar Wrapped USDC",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const _f="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/info/logo.png",Bf="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/assets/0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270/logo.png";var Rf={name:"polygon",id:"0x89",networkId:"137",namespace:"eip155",label:"Polygon (POS)",fullName:"Polygon (POS) Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMzEuNSA0NTkuM2MtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnYxOTQuNGMwIDE5LjIgOS42IDM2IDI0IDQzLjJsMTY1LjYgOTZjMTQuNCA5LjYgMzMuNiA5LjYgNDggMGwxNjUuNi05NmMxNC40LTkuNiAyNC0yNCAyNC00My4ydi02OS42bC03Ni44LTQzLjJ2NjQuOGMwIDE5LjItOS42IDM2LTI0IDQzLjJsLTg2LjQgNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtODYuNC01MC40Yy0xNC40LTkuNi0yNC0yNC0yNC00My4yVjU1MC41YzAtMTkuMiA5LjYtMzYgMjQtNDMuMmw4OC44LTUwLjRjMTQuNC05LjYgMzMuNi05LjYgNDggMGwxMTIuOCA2NC44IDc2LjggNDUuNiAxMTIuOCA2NC44YzE0LjQgOS42IDMzLjYgOS42IDQ4IDBsMTY4LTk2YzE0LjQtOS42IDI0LTI0IDI0LTQzLjJ2LTE5MmMwLTE0LjQtOS42LTMxLjItMjQtNDAuOGwtMTY4LTk2Yy0xNC40LTkuNi0zMy42LTkuNi00OCAwbC0xNjUuNiA5NmMtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnY2OS42bDc2LjggNDUuNnYtNjkuNmMwLTE5LjIgOS42LTM2IDI0LTQzLjJsODguOC01Mi44YzE0LjQtOS42IDMzLjYtOS42IDQ4IDBsODguOCA1MC40YzE0LjQgOS42IDI0IDI0IDI0IDQzLjJ2MTAwLjhjMCAxOS4yLTEyIDM2LTI0IDQzLjJsLTg4LjggNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtMTEyLjgtNjkuNi03OS4yLTQzLjItMTE3LjYtNjkuNmMtMTQuNC05LjYtMzMuNi05LjYtNDggMCAwIDIuNC0xNjAuOCA5OC40LTE2My4yIDk4LjR6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#824ee2",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMDkuNyA0NTljLTE2LjQgOS40LTI1LjggMjUuOC0yNS44IDQ2Ljl2MjA2LjNjMCAyMS4xIDkuNCAzNy41IDI1LjggNDYuOWwxNzUuOCAxMDMuMWMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBsMTc1LjgtMTAzLjFjMTYuNC05LjQgMjUuOC0yNS44IDI1LjgtNDYuOXYtNzIuN2wtODItNDYuOXY2OGMwIDIxLjEtOS40IDM3LjUtMjUuOCA0Ni45TDMzNyA3NjEuNGMtMTYuNCA5LjQtMzUuMiA5LjQtNTEuNiAwTDE5NCA3MDcuNWMtMTYuNC05LjQtMjUuOC0yNS44LTI1LjgtNDYuOVY1NTIuOGMwLTIxLjEgOS40LTM3LjUgMjUuOC00Ni45bDkzLjgtNTMuOWMxNC4xLTkuNCAzNS4yLTkuNCA1MS42IDBsMTE5LjUgNjggODIgNDkuMiAxMTkuNSA2OGMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBMODkwLjIgNTM0YzE2LjQtOS40IDI1LjgtMjUuOCAyNS44LTQ2LjlWMjgzLjJjMC0xNi40LTkuNC0zMi44LTI1LjgtNDIuMkw3MTIuMSAxMzcuOWMtMTYuNC05LjQtMzUuMi05LjQtNTEuNiAwTDQ4NC43IDI0MWMtMTYuNCA5LjQtMjUuOCAyNS44LTI1LjggNDYuOXY3NWw4MiA0OS4ydi03Mi43YzAtMjEuMSA5LjQtMzcuNSAyNS44LTQ2LjlsOTMuOC01Ni4zYzE2LjQtOS40IDM1LjItOS40IDUxLjYgMGw5My44IDUzLjljMTQuMSA5LjQgMjUuOCAyNS44IDI1LjggNDYuOXYxMDhjMCAyMS4xLTExLjcgMzcuNS0yNS44IDQ2LjlsLTkzLjggNTYuM2MtMTQuMSA5LjQtMzUuMiA5LjQtNTEuNiAwTDU0MSA0NzUuNGwtODItNDYuOS0xMjQuMi03Mi43Yy0xNC4xLTkuNC0zNS4yLTkuNC01MS42IDAtLjEuMS0xNzEuMiAxMDMuMi0xNzMuNSAxMDMuMnoiIGZpbGw9IiM4MjQ3ZTUiLz48L3N2Zz4=",currency:{name:"Polygon",symbol:"MATIC",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:_f},wrapped:{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",logo:Bf},stables:{usd:["0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359","0xc2132D05D31c914a87C6611C10748AEb04B58e8F"]},explorer:"https://polygonscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://polygonscan.com/tx/${t.id||t}`:e?`https://polygonscan.com/token/${e}`:n?`https://polygonscan.com/address/${n}`:void 0,endpoints:["https://polygon-rpc.com","https://polygon.meowrpc.com","https://polygon-bor.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"MATIC",name:"Polygon",decimals:18,logo:_f,type:"NATIVE"},{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",symbol:"WMATIC",name:"Wrapped Matic",decimals:18,logo:Bf,type:"20"},{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",type:"20"},{address:"0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xf6261529C6C2fBEB313aB25cDEcD243613b40EB5",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Uf="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDp1cmwoI1NWR0lEXzAwMDAwMDE5Njc2ODQzODE5NzI3MzAwODIwMDAwMDA1OTQ3NjMyODMzODYxMjM4OTE3Xyl9LnN0MntmaWxsOnVybCgjU1ZHSURfMDAwMDAwNjQzMjA1MjE4MTcxODM4NzM1NjAwMDAwMDMxNzkyNDIxNTkzMzkwODM5NjdfKX08L3N0eWxlPjxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfMV8iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iODE1Ljg1NiIgeTE9IjcwLjgyNCIgeDI9IjM4OC4zMzYiIHkyPSItNzQ4LjA1MiIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSA2NTcuOWM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDc5NS4xYy00LjkgNC45LTEyLjIgNy4zLTE3LjEgNy4zSDEyNS4zYy0xMi4yIDAtMTcuMS0xNC43LTkuOC0yNC41bDEyMi40LTEyMHoiIGZpbGw9InVybCgjU1ZHSURfMV8pIi8+PGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8wMDAwMDE1MDgxNTQ0MzI2NzI2OTc2MDQ0MDAwMDAxMzQ2MDgyNDM3MDQwMzE3MjU0M18iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iNjI4LjQ4MSIgeTE9IjE2NC4xMzQiIHgyPSIyMDAuOTYyIiB5Mj0iLTY1NC43NCIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSAyMDQuOGM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDM0MmMtNC45IDQuOS0xMi4yIDcuMy0xNy4xIDcuM0gxMjUuM2MtMTIuMiAwLTE3LjEtMTQuNy05LjgtMjJsMTIyLjQtMTIyLjV6IiBmaWxsPSJ1cmwoI1NWR0lEXzAwMDAwMTUwODE1NDQzMjY3MjY5NzYwNDQwMDAwMDEzNDYwODI0MzcwNDAzMTcyNTQzXykiLz48bGluZWFyR3JhZGllbnQgaWQ9IlNWR0lEXzAwMDAwMDA3NDA5ODc3MzYzMTA0OTgxNjMwMDAwMDE1MTMzNzA1NTcwNjgwMDk3NzA5XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI3MjAuOTIzIiB5MT0iMTE1Ljg3IiB4Mj0iMjkzLjQwNiIgeTI9Ii03MDMuMDAzIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMTkxLjQzNSkiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzAwZmZhMyIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2RjMWZmZiIvPjwvbGluZWFyR3JhZGllbnQ+PHBhdGggZD0iTTc2Mi4xIDQzMC4xYy00LjktNC45LTEyLjItNy4zLTE3LjEtNy4zSDEyNS4zYy0xMi4yIDAtMTcuMSAxNC43LTkuOCAyMkwyMzggNTY3LjNjNC45IDQuOSAxMi4yIDcuMyAxNy4xIDcuM2g2MTkuN2MxMi4yIDAgMTcuMS0xNC43IDkuOC0yMkw3NjIuMSA0MzAuMXoiIGZpbGw9InVybCgjU1ZHSURfMDAwMDAwMDc0MDk4NzczNjMxMDQ5ODE2MzAwMDAwMTUxMzM3MDU1NzA2ODAwOTc3MDlfKSIvPjwvc3ZnPgo=",Qf="https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png";var Yf={name:"solana",networkId:"solana",namespace:"solana",label:"Solana",fullName:"Solana Mainnet Beta",logo:Uf,logoBackgroundColor:"#000000",logoWhiteBackground:Uf,currency:{name:"Solana",symbol:"SOL",decimals:9,address:"11111111111111111111111111111111",logo:Qf},wrapped:{address:"So11111111111111111111111111111111111111112",logo:Qf},stables:{usd:["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"]},explorer:"https://solscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://solscan.io/tx/${t.id||t}`:e?`https://solscan.io/token/${e}`:n?`https://solscan.io/address/${n}`:void 0,endpoints:["https://swr.xnftdata.com/rpc-proxy","https://solana-rpc.publicnode.com","https://mainnet-beta.solflare.network","https://endpoints.omniatech.io/v1/sol/mainnet/public"],sockets:["wss://solana.drpc.org","wss://mainnet-beta.solflare.network","wss://solana.a.exodus.io"],tokens:[{address:"11111111111111111111111111111111",symbol:"SOL",name:"Solana",decimals:9,logo:Qf,type:"NATIVE"},{address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://img.raydium.io/icon/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v.png",type:"SPL"},{address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",symbol:"USDT",name:"USDT",decimals:6,logo:"https://img.raydium.io/icon/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB.png",type:"SPL"},{address:"7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj",symbol:"stSOL",name:"Lido Staked SOL",decimals:9,logo:"https://img.raydium.io/icon/7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj.png",type:"SPL"},{address:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",symbol:"BONK",name:"BONK",decimals:5,logo:"https://img.raydium.io/icon/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263.png",type:"SPL"},{address:"7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",symbol:"SAMO",name:"Samoyed Coin",decimals:9,logo:"https://img.raydium.io/icon/7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU.png",type:"SPL"},{address:"DePay1miDBPWXs6PVQrdC5Vch2jemgEPaiyXLNLLa2NF",symbol:"DEPAY",name:"DePay",decimals:9,logo:"https://depay.com/favicon.png",type:"SPL"}],zero:"0",maxInt:"340282366920938463463374607431768211455"};const Wf="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDojMjEzMTQ3fTwvc3R5bGU+PHBhdGggZD0iTTkyIDkyaDgxNnY4MTZIOTJWOTJ6IiBmaWxsPSJub25lIi8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTE2NS44IDM0MC4xVjY2MGMwIDIwLjYgMTAuOCAzOS4yIDI4LjcgNDkuNmwyNzcuMSAxNTkuOWMxNy42IDEwLjEgMzkuNSAxMC4xIDU3LjEgMGwyNzcuMS0xNTkuOWMxNy42LTEwLjEgMjguNy0yOSAyOC43LTQ5LjZWMzQwLjFjMC0yMC42LTEwLjgtMzkuMi0yOC43LTQ5LjZsLTI3Ny4xLTE2MGMtMTcuNi0xMC4xLTM5LjUtMTAuMS01Ny4xIDBsLTI3Ny4xIDE2MGMtMTcuNiAxMC4xLTI4LjQgMjktMjguNCA0OS42aC0uM3oiLz48cGF0aCBkPSJtNTYwLjQgNTYyLTM5LjUgMTA4LjRjLTEgMi45LTEgNi4yIDAgOS41bDY3LjkgMTg2LjQgNzguNi00NS40LTk0LjMtMjU4LjhjLTIuMy02LTEwLjQtNi0xMi43LS4xem03OS4zLTE4Mi4xYy0yLjMtNS45LTEwLjQtNS45LTEyLjcgMGwtMzkuNSAxMDguNGMtMSAyLjktMSA2LjIgMCA5LjVMNjk4LjggODAzbDc4LjYtNDUuNC0xMzcuNy0zNzcuNHYtLjN6IiBmaWxsPSIjMTJhYWZmIi8+PHBhdGggZD0iTTUwMCAxNDIuNmMyIDAgMy45LjYgNS41IDEuNmwyOTkuNiAxNzNjMy42IDIgNS41IDUuOSA1LjUgOS44djM0NmMwIDMuOS0yLjMgNy44LTUuNSA5LjhsLTI5OS42IDE3M2MtMS42IDEtMy42IDEuNi01LjUgMS42cy0zLjktLjYtNS41LTEuNmwtMjk5LjYtMTczYy0zLjYtMi01LjUtNS45LTUuNS05LjhWMzI2LjdjMC0zLjkgMi4zLTcuOCA1LjUtOS44bDI5OS42LTE3M2MxLjYtMSAzLjYtMS42IDUuNS0xLjZ2LjN6bTAtNTAuNmMtMTAuOCAwLTIxLjIgMi42LTMxIDguMmwtMjk5LjYgMTczYy0xOS4yIDExLjEtMzEgMzEuMy0zMSA1My41djM0NmMwIDIyLjIgMTEuOCA0Mi40IDMxIDUzLjVsMjk5LjYgMTczYzkuNSA1LjUgMjAuMiA4LjIgMzEgOC4yczIxLjItMi42IDMxLTguMmwyOTkuNi0xNzNjMTkuMi0xMS4xIDMxLTMxLjMgMzEtNTMuNXYtMzQ2YzAtMjIuMi0xMS44LTQyLjQtMzEtNTMuNWwtMjk5LjktMTczYy05LjUtNS41LTIwLjItOC4yLTMxLTguMmguM3oiIGZpbGw9IiM5ZGNjZWQiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJtMzAxLjUgODAzLjIgMjcuOC03NS43IDU1LjUgNDYtNTEuOSA0Ny43LTMxLjQtMTh6Ii8+PHBhdGggZD0iTTQ3NC41IDMwMi4yaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOEwyMjIuOSA3NTcuNWw3OC42IDQ1LjRMNDgxLjEgMzExYzEuNi00LjYtMS42LTkuMS02LjItOS4xbC0uNC4zem0xMzMuMiAwaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOGwtMTg2IDUwOS44IDc4LjYgNDUuNEw2MTMuOSAzMTFjMS42LTQuNi0xLjYtOS4xLTYuMi05LjF2LjN6IiBmaWxsPSIjZmZmIi8+PC9zdmc+Cg==";var Ff={name:"arbitrum",id:"0xa4b1",networkId:"42161",namespace:"eip155",platform:"evm",label:"Arbitrum",fullName:"Arbitrum One",logo:Wf,logoBackgroundColor:"#2b354d",logoWhiteBackground:Wf,currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Df.currency.logo},wrapped:{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",logo:Df.wrapped.logo},stables:{usd:["0xaf88d065e77c8cC2239327C5EDb3A432268e5831","0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"]},explorer:"https://arbiscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://arbiscan.io/tx/${t.id||t}`:e?`https://arbiscan.io/token/${e}`:n?`https://arbiscan.io/address/${n}`:void 0,endpoints:["https://arbitrum.blockpi.network/v1/rpc/public","https://arbitrum-one.publicnode.com","https://endpoints.omniatech.io/v1/arbitrum/one/public"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:Df.currency.logo,type:"NATIVE"},{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:Df.wrapped.logo,type:"20"},{address:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8/logo.png",type:"20"},{address:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1/logo.png",type:"20"},{address:"0x912CE59144191C1204E64559FE8253a0e49E6548",symbol:"ARB",name:"Arbitrum",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0x912CE59144191C1204E64559FE8253a0e49E6548/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Vf="https://traderjoexyz.com/static/media/avalanche.7c81486190237e87e238c029fd746008.svg",Hf="https://raw.githubusercontent.com/traderjoe-xyz/joe-tokenlists/main/logos/0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7/logo.png";var Gf={name:"avalanche",id:"0xa86a",networkId:"43114",namespace:"eip155",platform:"evm",label:"Avalanche",fullName:"Avalanche C-Chain",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0zNTkuMSA3NTEuMWgtOTUuM2MtMjAgMC0yOS45IDAtMzYtMy44LTYuNi00LjMtMTAuNC0xMS4zLTEwLjktMTguOS0uMy03LjEgNC42LTE1LjggMTQuNC0zM2wyMzUtNDE0LjNjMTAuMS0xNy42IDE1LjEtMjYuNCAyMS40LTI5LjYgNi45LTMuNSAxNS4xLTMuNSAyMS45IDAgNi40IDMuMyAxMS40IDEyIDIxLjQgMjkuNmw0OC40IDg0LjMuMi41YzEwLjggMTguOSAxNi4zIDI4LjUgMTguNiAzOC41IDIuNiAxMC45IDIuNiAyMi42IDAgMzMuNS0yLjQgMTAuMS03LjggMTkuOC0xOC44IDM4LjlMNDU2LjIgNjk0LjlsLS4zLjVjLTEwLjggMTktMTYuMyAyOC43LTI0LjEgMzYtOC4zIDgtMTguMyAxMy43LTI5LjMgMTYuOS05LjkgMi44LTIxLjEgMi44LTQzLjQgMi44em0yNDAuMyAwaDEzNi40YzIwLjIgMCAzMC4yIDAgMzYuMy00IDYuNi00LjMgMTAuNi0xMS4zIDEwLjktMTkuMS4zLTYuOS00LjUtMTUuMi0xMy45LTMxLjZsLTEtMS43TDY5OS44IDU3OGwtLjgtMS4yYy05LjYtMTYuMy0xNC40LTI0LjUtMjAuNy0yNy42LTYuOS0zLjYtMTUtMy42LTIxLjcgMC02LjIgMy4zLTExLjMgMTEuOC0yMS4zIDI5bC02OC4xIDExNi45LS4yLjNjLTEwLjEgMTcuMi0xNSAyNS44LTE0LjUgMzIuOC41IDcuNyA0LjUgMTQuOSAxMC45IDE5IDUuNyAzLjkgMTUuOCAzLjkgMzYgMy45eiIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#E84142",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yMzUuNiAyNTkuNWg1MjguOXY0ODFIMjM1LjZ2LTQ4MXoiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNOTI4IDUwMGMwIDIzNi40LTE5MS42IDQyOC00MjggNDI4UzcyIDczNi40IDcyIDUwMCAyNjMuNiA3MiA1MDAgNzJzNDI4IDE5MS42IDQyOCA0Mjh6TTM3OC43IDY3MC4zaC04My4xYy0xNy41IDAtMjYuMSAwLTMxLjMtMy40LTUuNy0zLjctOS4xLTkuOC05LjYtMTYuNS0uMy02LjIgNC0xMy44IDEyLjYtMjguOUw0NzIuNSAyNjBjOC43LTE1LjQgMTMuMS0yMyAxOC43LTI1LjkgNi0zIDEzLjEtMyAxOS4xIDAgNS42IDIuOCAxMCAxMC41IDE4LjcgMjUuOWw0Mi4yIDczLjYuMi40YzkuNCAxNi41IDE0LjIgMjQuOCAxNi4zIDMzLjYgMi4zIDkuNiAyLjMgMTkuNiAwIDI5LjItMi4xIDguOC02LjggMTcuMi0xNi40IDM0TDQ2My42IDYyMS4ybC0uMy41Yy05LjUgMTYuNi0xNC4zIDI1LTIxIDMxLjQtNy4zIDYuOS0xNiAxMi0yNS41IDE0LjgtOC43IDIuNC0xOC41IDIuNC0zOC4xIDIuNHptMjA5LjggMGgxMTljMTcuNiAwIDI2LjQgMCAzMS43LTMuNSA1LjctMy43IDkuMi05LjkgOS42LTE2LjYuMy02LTMuOS0xMy4zLTEyLjItMjcuNWwtLjktMS41LTU5LjYtMTAyLS43LTEuMWMtOC40LTE0LjItMTIuNi0yMS4zLTE4LTI0LjEtNi0zLTEzLjEtMy0xOSAwLTUuNSAyLjgtOS45IDEwLjMtMTguNiAyNS4zbC01OS40IDEwMi0uMi40Yy04LjcgMTUtMTMgMjIuNS0xMi43IDI4LjcuNCA2LjcgMy45IDEyLjkgOS42IDE2LjYgNSAzLjMgMTMuOCAzLjMgMzEuNCAzLjN6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2U4NDE0MiIvPjwvc3ZnPg==",currency:{name:"Avalanche",symbol:"AVAX",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Vf},wrapped:{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",logo:Hf},stables:{usd:["0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7","0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"]},explorer:"https://snowtrace.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://snowtrace.io/tx/${t.id||t}`:e?`https://snowtrace.io/token/${e}`:n?`https://snowtrace.io/address/${n}`:void 0,endpoints:["https://avalanche.public-rpc.com","https://avalanche.blockpi.network/v1/rpc/public","https://avax.meowrpc.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"AVAX",name:"Avalanche",decimals:18,logo:Vf,type:"NATIVE"},{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",symbol:"WAVAX",name:"Wrapped AVAX",decimals:18,logo:Hf,type:"20"},{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7/logo.png",type:"20"},{address:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E/logo.png",type:"20"},{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xd586E7F844cEa2F87f50152665BCbc2C279D8d70/logo.png",type:"20"},{address:"0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const qf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAMAAAAKTh9YAAAAYFBMVEVHcEz////////////////////////////////////j++ma6qVj5nsl5lAK4zpA6mXO79aD8Zyr87uCvq0J2TkItEkOhl4EeVsKzSwLrxMNtQpjsZG42dEeuxyF2oU6wzjPwJjeAAAACnRSTlMAEUB9r9j/YO+Kf6/iMwAABD1JREFUeAHU1EESQjEMAlBIAq33v7ArV7+OLss7AZOB4IDVI/kW0nQRf+Ca7QvNwg/s7VtpGJP8oPFNybdT4aidoPHEcYZn6ymnEEOjH8KPk0zeTI+DLacpfMhpxKTGnFtDB9o8/Jisw8uxh1/OtGIrYw9Ah9pEOVWhnaoxTvWCnErR2Z3rzX59JMYOAkEYXr1gRJfIzP1PalbOpZm2aEf+tcKnCCz7bS37si/7si/7si/7si/7srvRHAE5kJHdbV4wkn076Q9RMMLu04fYnceT/An9JnhMkr19Ezwvvvee73ieOL1dfdN15yQlwas2S7vbgTn4iLfaDO0emIPPeLtgZt+AOfhcQHJGdieYg88VLG9k98AUfG7gBRu7YAo+9wpeNLEnYAY+915wkIndQ4Xn9IajgoV9hwbP6b3iqGRhF5zH537VHi3swGl87tft3tB+Ap/7Z9lFhef0z3hndmjwnP4Z32qEAs/po4//Rwao8JzeC3hiMyeACs/ppnMCUlThOf3wxjurObAKz+kHNz5arT0CNHhO5zde7NZ8UYXn9N4K2Utnt8NzOsFL+Kuz2+EJneA5nduN8bmTWsXzKqNzuyX+FZ3rL43Sud0Un/txtV7KqNY+6Hq7Kb71Gxt0W7seX5od/Z6a+8BuGASCMMwraRK4103A9z9leq+Q3zCYC+h7oy7tbr6d4zGd2zme04Ed4AEd2AEe0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2Tl+B+jQzvH7j/ThnNub4Xd7Rud2gLc9pyM7wO9sz+nEDvA7e8G/0vX2IeTan/DXPdWL+cwD/hl/c3r2lT2u7XbWk31aYt9vesp9yD5Xn1ZPx7svtNtMYwfX9/hqjwAvuq8awIufZwzgxc+RZgAvfn43gBe/N5lxPLAD+sTs2HgnS53jnS51jHfC1CneKVOHeCdNneGdNnWEd+LUCd6pUwd4p04d4J06dYB3tekAL64nSAAvr+PgeGYHdI6ndkDneGoHdI4HdkAvxw/V7IsiegU8sIdSejk+VbIvyumveBY8twdQh51A8PL691x8PBf3HRD8oO33QPhR2mfD8EnZ3wTxXthXRvFe18+H8anbPsqkOVfnnJ6DF/RmPdE5vs69aQiYnoH3rXuzXukcP6jmE3C8734uxAgfgSvM4+D4RcV37SmgZ+BT6/kz0yd6KT5+kcex9bel+fDPupXP+MOs8byl6esGYfRxbDPnanG0OVf+8ODeH9Ks5f+mE50vJlp37d23EQQhFATRr6Yg/4RPuSe9o6tmIni7gN2222677bbbbrvttttuu5sw/7EP1j7kfhO6m5Wbak90Jw7d54NeGsV9jb0y1B+f+P5qpHB08XvD8M4zrq9N7pqje/L8jj/twXa8XOl4uSoe4/363RnvlyOo/LE1R8JnZfywrB7pGLY0Xa/gV5AhY9e5oJHCAAAAAElFTkSuQmCC",Zf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAYAAAA9kO9qAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0PSURBVHgB7d1LbFzVHcfx37l3/CDGxgkhxEnU2K1EgxoUN0kVUglhIhbdVAo7dpCiSl2BqbqphIRpuy5u95SwY1XSWlXVIhFXtGqjJsXQSJRCsXklaQiJ8zCxPTP3cv53cuOxZ8bjmbmP8z/n/5GMHcfjmPHXZ86ce++xQpJGxwdRwChCtQ9Q+nU4qt87CIVhCLGeEHP6v/NQag5h8DY8TKOEGcxMziMhCp2iwD0c1V/kE/QnUNxCJGdavxzHmRdfQYfajz2K3HsGKhyHBC7SN6dznUY5eEGP9nNoQ+uxS+Qib6GawL9++QJa1FrsB8fH9D/0sn5rGELka04PuMdwenJ6ozfwN/qB2D/+vP7ZOA4ZzYUZdIfqSQx9Fzj/979s5AbNR3aatvieHs3DoxDCSOqEnssfa7Zys37s0VKiOqmXhUYhhMlCvUwZhI+sF3zj2CV0wU2T4L2GN6Spi4QuOFG612jKXV/9J6j0ZFThRxCCnz2NnrTWTmMqy4snIQRnSk9n1ixL1k5jKuvoQvBGHdPzziqrY4/W0uWAkbDCMDw1Xv2OlWnM6PgwfDULIewxj3I4Eq/OrIzsvpqAEHYZrB7dq6cxD0MI2yg8E8/dK7HvH38SMlcXdqpcb4E49sqFF0LY6VbfqnKil7oCIewVPVH1omtGhbBbdG20hwBjEMJ2AcWuvH0QwnYK+zyE4TCEsF2oaGSXy+yEA3TntPQ4DCHsN+xBCEdI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwRgEWU30loK9c+cOCj3DB6v/dtqltS7ffDi/2wFZWffcpbv/IJXh7r8Hfe70SexWKPZjdhPKpzdGLzd/Y9dD9Uzh0BR69VIUeo/somO1D6c0tCN6y50I2hQPPhmCORqauxz9D4cjnLd2u9MY9KL6605noC9+/EN1PaweB9dB9Q/cR3VfcsY+9nW/gWsWpIRRf+hpspUa+RM/T/4OnX7eLol987n7WAwPb2Cnurqdn9cPxZSTBhm9mPfRo1/XUxx0NBtWWX9qN0tR2cMRyNYa+cT2/eDex0KPPqadCvfpzqjpzWK4Kj51D99MfJhY66X7qo+jRlCOWsdNI1clDciM2Be8/9AW6n/gEaaDg6UkuN+xip1Gl1SeirbAheH/0Krp/OIc09fz0v4k+YmSBVewUYBYPoZyD976xgMLjn0INpBui0scv6BGWE1ax06qLl1GAHIOn0D09qvt7biAL9Airdic/nUwLq9iznidyCj4KXb/438l2q/2uR9ObUiaNTex+g6N9aeMQfBx69PaORWTJPyKxJ45iz4vJwVeHrrYupz5XX4vm7mpkARywiT3v0EwMvjr0SH8RefBHeMzb2cTuGXCHmhR8Tej0Pj2y54HLk3g+I7sha7omBF8v9EhPgDxI7BbLM/iGoedpyQcHbGIPDDtBK4/gm4a+lM+3M7zK47IINrGbeDZilsFvZEQPr3UhD3ShBwd8Yp/dBBNlEfxGpy7huV7kIfjkDnDAJvbSqc0wVZrBtzJHD68X9Oie7ZSCHnHz+iFrFZ85+9kBoy+YTiP4dp6MBu/diSwV/3gvuGC1GlOaMvuOTTL4dlddyu/chTDDJ6rlv20BF8xiHzJuVWatJILvaHlRhx68M4AsFF/dxeoyRlaxhws+ln/9dZiuk+CTWEePRveU5+7xrgOcsDuoRHN3DndyO8EndsBIj+6l3w2lNp2h5050cTo3LI+g0sOnbcEnfWSUVmZKJ5IPPg6d4y4MPnYcngBDNMIT2vnLZHQKLO2+RTuQocFqUmqnANz0EX5wZ3QSnUrgvJnwcjcWJ/YYe8yjGbaxExuCT/1cl2VPx9kXxa46OCuy/O8BLP38Pr2mzuMAUj2sYyecg8/spC4dPB3SD/7T33L0wWe9KP15G5Z/sxuY7wZnVuz1SLoe/zS6INt08c5jqr+U29mL9G+rHYt6erMQnRZMf7799ekfDFzqRqBfwvf6EdzwUT6tf0Cv898D15rYCZvg9dy3+Id7jQ8oLCprQidWnc/OZpVmyzK6jp4H+s3dZMi20Il1F2+wCV6HbmrwNoZOrLxSSYJvn62hE2svy5PgW2dz6MTqa1Al+I2zPXRi/QXXEnxzLoROnNhdQIJvzJXQiTNbaUjwtVwKnTi1b4wEv8K10IlzmyRJ8G6GTpzcEczl4F0NnTi7/R234NWmzi/idjl04vRej6yCf/R9qJ4OfmnvTc/p0InzG5tyCR67+tB94FRbwUvoFbKLL3gF3/PAmy0Ffzv0mzx22k2TxH4Lh+DDzVug+pY2HLyEvprEXsX44H0fwcBdUL1fNg1eQq8lsa9BwZemtsNYd1QueG4WvIReS2KvI9rWzdRNVLtXLnpuFHxAu+pK6DUk9jpom73gbD9MFPau3sqiXvDhZzy2kM6axN4ABc9FTfBlBVFLYm9Abcvn1yw2VS7Xffft4PuuAr35/NY800nsddDejP7eazBSg9hJHLw/fBGilsReh8l7z6jFm+v/faGI3u+9Dm/7FxCrSexr0EZLhSOfw1Tqxo3mH6OD3/SD30vwa0jsVTjsKKYWmscefVzvsgS/hsR+C4vQr1xed85e8/ES/CoSO/jsEen9/wJaJcGvcD52LqGrS/p5xHJ7y6ESfIXTsXMJnSL3znX2dUrwDsfOKXT/ww+QBNeDdzJ2dqEvJ3c01+XgnYvd5dBjrgbvVOwS+goXg3cmdgm9lmvBOxG7hN6YS8FbH7uE3pwrwVsdu4S+cS4Eb23sEnrrbA/eytgl9PbZHLx1sUvonbM1eKtiZ/Mbrq8pY0OP2Ri8NbGzCf1iDxZ/sg9Lf3oAprMteCtiZxX6c/dHr5dPHsTSyQMwnU3Bs4+dY+gxCT5brGPnHHpMgs8O29htCD0mwWeDZew2hR7jFrwavA5u2MVeOHTZutBjvIKf0q87/6VmWeIX+1Mfw3TthB7jErynR/auw2fBCavYaacub5vZo0knoce4BN99+B1Wozuv2A2fviQReoxD8DSd4TS6s4nd23vN6FE9ydBjHILv+vZ74IJN7IVDV2CqNEKPmR48zd25rMywiV2NtP/bndOUZugx04P3R86BAz6xGziFySL0mMnBezKyJ8u0+XqWocdMDd7r57EiI7v4tiGP0GNcliVNxCZ2U34vaZ6hx0wLPrie333RCj6xX+xG3kwIPWZS8MH8ZnDAJvbg7ADyZFLoMVOCD84PggM2sZdO5Td6mBh6LO/gg/l+BBfuBgd8pjGzfbnM200OPZZn8OXZIXDB6Amqj9LUvcgSh9BjeQW/pP9dLlgtPZamhjIb3TmFHss6+OJb9yHU0xguWMVOo3vx1R1IG8fQYxT84m/HkDaaq3Ma1Qm7g0o0upfeuAdp4Rx6rDjzzdSDX5p6mNWoTlgeQS2+tBvB7CYkzYbQY2kGv/j6gyi9vxPc+NhxeALcFD2U/7oVatdNeLsWkQT64Vn62R4rQo8FF7YivNIPf+Q8VGHjvxm7kXCxR4/oD6F46lvgSOHAsyEYS2KngdLUdv1cYKcxpyQkjc5KvOPYFLzN7Z+dGJy/Gzdfe4TNmno97GMndPovRV84cqml25X1UVmKPO+js1mhq4q6x860FD09EV1+cz+K/9wD7qyIPUbR0+V7/qEr8Pdeh+orrfp7GrlpulLWR2PLb2y1diRvxh8+F4VPmx35Q6s3PApLXQg+H0B5Ti8EvDuiX6e/+pUVq2Kv5/ZFH3rZ0tW4m4l2COitbJ/NbYWlFdZ/9216wpkWeuKJRfvvJ7l4QzhDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyj2OQhhvzkPIeYhhO105zr28G0IYTsVfuRBYQZC2C7EjKdn7RK7sJ+HaQ+lKHaZtwu7lWhkn5mk0GV0Fzabps4r6+xh+AqEsNdx+k8l9gAnIFMZYaNQH0c682I0mFdip6lMGP4KQthGhdPxmyunCwSYhIzuwjZlvBC/uRK7jO7CNkqHPjM5F/9x9YlgNLqHcq6MsAB1fPrFiep3rY6dRncvPAYhuKvTsV/zQef+MYedDyr9GDAGITii6cvpyeO1727kwI9f048FRyEEK+EJnJl8rN7fNL54oxwco5NnIAQX1GsZDafhat0bj44PwlMn9UeNQgiTUehB+Mit01/qWv+yPLohfQKoExDCWHrq0iR0sv7IXu3g+ARC9TyEMEn0ZHT1EmPjD23FwfExBOplfathCJEnWken5cXTk9MbvUlrscdklBd5oWumPX2kv6QPgDaZtqzVXuxkdHwYvtLR42EZ6UXqOog81n7s1faPP6k/0xNyIEokigJX4Yx+/Up0GnqbkceSiT1GS5UFvUwZYEx/5n36ixzW/8SgjPyiqeicrHC+sgGAmtGRvx1dMtph4NW+AiZycfiu2QTRAAAAAElFTkSuQmCC";var Jf={name:"gnosis",id:"0x64",networkId:"100",namespace:"eip155",label:"Gnosis",fullName:"Gnosis Chain",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojZmZmfTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMzMS45IDU1Ni41YzIzLjUgMCA0Ni40LTcuOCA2NS0yMi4yTDI0OCAzODUuNGMtMzUuOSA0Ni40LTI3LjQgMTEyLjkgMTguOSAxNDguOCAxOC42IDE0IDQxLjUgMjEuOSA2NSAyMS45di40em00NDIuMy0xMDYuMWMwLTIzLjUtNy44LTQ2LjQtMjIuMi02NUw2MDMuMiA1MzQuMmM0Ni40IDM1LjkgMTEyLjkgMjcuNCAxNDguOC0xOC45IDE0LjMtMTguNiAyMi4yLTQxLjQgMjIuMi02NC45eiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im04NDkuMiAyODguNS02NS45IDY1LjljNTIuOSA2My42IDQ0LjcgMTU4LTE4LjkgMjExLjItNTUuNiA0Ni43LTEzNi42IDQ2LjctMTkyLjIgMEw1MDAgNjM3LjdsLTcyLjEtNzIuMWMtNjMuNiA1Mi45LTE1OCA0NC43LTIxMS4yLTE4LjktNDYuNy01NS42LTQ2LjctMTM2LjYgMC0xOTIuMmwtMzMuNi0zMy42LTMyLTMyLjNDMTEyLjMgMzUyLjIgOTIgNDI1LjMgOTIgNTAwYzAgMjI1LjIgMTgyLjggNDA4IDQwOCA0MDhzNDA4LTE4Mi44IDQwOC00MDhjLjMtNzQuNC0yMC42LTE0Ny44LTU4LjgtMjExLjV6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTc5NS4xIDIxOC4zYy0xNTUuNC0xNjIuOC00MTMuNi0xNjktNTc2LjQtMTMuNy00LjkgNC42LTkuNSA5LjEtMTMuNyAxMy43LTEwLjEgMTAuOC0xOS42IDIxLjktMjguNyAzMy4zTDUwMCA1NzUuNGwzMjMuOC0zMjMuOGMtOC44LTExLjctMTguNi0yMi44LTI4LjctMzMuM3pNNTAwIDE0NS4yYzk1LjMgMCAxODQuMSAzNi45IDI1MSAxMDMuOEw1MDAgNTAwIDI0OSAyNDljNjYuNi02Ny4yIDE1NS43LTEwMy44IDI1MS0xMDMuOHoiLz48L3N2Zz4K",logoBackgroundColor:"#406958",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojM2U2OTU3fTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMyNC4yIDU1OS4xYzI0LjYgMCA0OC41LTguMiA2Ny45LTIzLjJMMjM2LjUgMzgwLjJjLTM3LjUgNDguNS0yOC43IDExOC4xIDE5LjggMTU1LjYgMTkuNSAxNC43IDQzLjMgMjIuOSA2Ny45IDIyLjl2LjR6TTc4Ni43IDQ0OC4xYzAtMjQuNi04LjItNDguNS0yMy4yLTY3LjlMNjA3LjkgNTM1LjhjNDguNSAzNy41IDExOC4xIDI4LjcgMTU1LjYtMTkuOCAxNS0xOS40IDIzLjItNDMuMyAyMy4yLTY3Ljl6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0ibTg2NS4yIDI3OC44LTY4LjkgNjguOWM1NS4zIDY2LjYgNDYuOCAxNjUuMi0xOS44IDIyMC44LTU4LjQgNDguOC0xNDIuNyA0OC44LTIwMSAwTDUwMCA2NDRsLTc1LjQtNzUuNGMtNjYuNiA1NS4zLTE2NS4yIDQ2LjgtMjIwLjgtMTkuOC00OC44LTU4LjQtNDguOC0xNDIuNyAwLTIwMWwtMzUuMi0zNS4yLTMzLjQtMzMuOGMtNDAuNiA2Ni42LTYxLjggMTQzLTYxLjggMjIxLjIgMCAyMzUuNSAxOTEuMSA0MjYuNiA0MjYuNiA0MjYuNlM5MjYuNiA3MzUuNSA5MjYuNiA1MDBjLjQtNzcuOC0yMS41LTE1NC42LTYxLjQtMjIxLjJ6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTgwOC42IDIwNS41QzY0Ni4xIDM1LjEgMzc2LjEgMjguNyAyMDUuOCAxOTEuMWMtNS4xIDQuOC05LjkgOS42LTE0LjMgMTQuMy0xMC42IDExLjMtMjAuNSAyMi45LTMwIDM0LjhMNTAwIDU3OC44bDMzOC42LTMzOC42Yy05LjItMTIuMi0xOS41LTIzLjgtMzAtMzQuN3pNNTAwIDEyOWM5OS43IDAgMTkyLjUgMzguNiAyNjIuNSAxMDguNUw1MDAgNTAwIDIzNy41IDIzNy41QzMwNy4yIDE2Ny4yIDQwMC4zIDEyOSA1MDAgMTI5eiIvPjwvc3ZnPgo=",currency:{name:"xDAI",symbol:"xDAI",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:qf},wrapped:{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",logo:Zf},stables:{usd:["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"]},explorer:"https://gnosisscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://gnosisscan.io/tx/${t.id||t}`:e?`https://gnosisscan.io/token/${e}`:n?`https://gnosisscan.io/address/${n}`:void 0,endpoints:["https://rpc.gnosis.gateway.fm","https://rpc.gnosischain.com","https://gnosis.blockpi.network/v1/rpc/public"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"xDAI",name:"xDAI",decimals:18,logo:qf,type:"NATIVE"},{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",symbol:"WXDAI",name:"Wrapped XDAI",decimals:18,logo:Zf,type:"20"},{address:"0x4ECaBa5870353805a9F068101A40E0f32ed605C6",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb",symbol:"GNO",name:"Gnosis",decimals:18,logo:"https://cdn.sushi.com/image/upload/f_auto,c_limit,w_16,q_auto/tokens/100/0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb.jpg",type:"20"},{address:"0xD057604A14982FE8D88c5fC25Aac3267eA142a08",symbol:"HOPR",name:"HOPR",decimals:18,logo:"https://hoprnet.org/assets/icons/hopr_icon.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};var Xf={name:"optimism",id:"0xa",networkId:"10",namespace:"eip155",label:"Optimism",fullName:"Optimism",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00ODcuMSAzOTUuN2MtNS4yLTE1LjgtMTMuMi0zMS43LTI2LjQtNDIuMi0xMy4yLTEwLjUtMjYuNC0yMS4yLTQ0LjktMjYuNC0xOC41LTUuMi0zNy04LTU4LjEtOC00Ny41IDAtODcuMSAxMC41LTExNi4xIDM0LjQtMjkgMjMuOC00Ny41IDU4LjEtNjAuNyAxMDIuOS0yLjYgMTUuOC04IDI5LTEwLjUgNDQuOS0yLjYgMTMuMi01LjIgMjktOCA0Mi4yLTIuNiAyMy44LTIuNiA0Mi4yIDIuNiA2MC43IDUuMiAxNS44IDEzLjIgMzEuNyAyNi40IDQyLjIgMTMuMiAxMC41IDI2LjQgMjEuMiA0NC45IDI2LjQgMTguNCA1LjIgMzcgOCA1OC4xIDggNDcuNSAwIDg3LjEtMTAuNSAxMTYuMS0zNC40czQ3LjUtNTguMSA2MC43LTEwMi45YzIuNi0xMy4yIDUuMi0yOSAxMC41LTQyLjIgMi42LTEzLjIgNS4yLTI5IDgtNDQuOSAyLjgtMjMuOCAyLjgtNDQuOC0yLjYtNjAuN3ptLTkyLjQgNjAuOGMtMi42IDEzLjItNS4yIDI2LjQtOCAzOS41LTIuNiAxMy4yLTUuMiAyNi40LTEwLjUgNDIuMi01LjIgMjMuOC0xNS44IDM5LjUtMjkgNTAuMi0xMy4yIDEwLjUtMjkgMTUuOC00Ny41IDE1LjgtMTguNCAwLTMxLjctNS4yLTM5LjUtMTUuOC04LTEwLjUtMTAuNS0yOS01LjItNTAuMiAyLjYtMTUuOCA1LjItMjkgOC00Mi4yIDIuNi0xMy4yIDUuMi0yNi40IDEwLjUtMzkuNSA1LjItMjMuOCAxNS44LTM5LjUgMjktNTAuMiAxMy4yLTEwLjUgMjktMTUuOCA0Ny41LTE1LjggMTguNCAwIDMxLjcgNS4yIDM5LjUgMTUuOCA3LjkgMTAuNiAxMC41IDI2LjMgNS4yIDUwLjJ6bTQ0MC45LTY4LjZjLTUuMi0xNS44LTEzLjItMjYuNC0yMy44LTM3cy0yMy44LTE1LjgtNDIuMi0yMS4yYy0xNS44LTUuMi0zNC40LTgtNTUuNC04SDU3OS43Yy0yLjYgMC01LjIgMC0xMC41IDIuNi0yLjYgMi42LTUuMiA1LjItNS4yIDhsLTY4LjYgMzI3LjRjMCAyLjYgMCA4IDIuNiA4IDIuNiAyLjYgNS4yIDIuNiA4IDIuNmg2OC42YzIuNiAwIDggMCAxMC41LTIuNnM1LjItNS4yIDUuMi04bDIzLjgtMTEwLjloNjguNmM0Mi4yIDAgNzYuNi04IDEwMi45LTI2LjQgMjYuNC0xOC40IDQyLjItNDcuNSA1MC4yLTg0LjYgNS4xLTE4LjQgNS4xLTM2LjctLjItNDkuOXpNNzQzLjEgNDM4Yy0yLjYgMTUuOC0xMC41IDI2LjQtMjEuMiAzNC40cy0yMy44IDEwLjUtMzcgMTAuNWgtNTguMWwxOC40LTg5LjdoNjAuN2MxMy4yIDAgMjEuMiAyLjYgMjYuNCA1LjIgNS4yIDUuMiAxMC41IDEwLjUgMTAuNSAxNS44IDMgNS4yIDMgMTMuMi4zIDIzLjh6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",logoBackgroundColor:"#FF0420",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iMzk2LjYiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNNTAwIDg5Ni42YzIxOS4xIDAgMzk2LjYtMTc3LjYgMzk2LjYtMzk2LjZTNzE5LjEgMTAzLjQgNTAwIDEwMy40IDEwMy40IDI4MC45IDEwMy40IDUwMCAyODAuOSA4OTYuNiA1MDAgODk2LjZ6TTM1MC43IDYwOWMxMC45IDMuNCAyMi42IDUuMSAzNS4zIDUuMSAyOS4xIDAgNTIuNC02LjcgNjkuNi0yMC4yIDE3LjMtMTMuNyAyOS4zLTM0LjMgMzYuMi02MS44IDItOC42IDMuOS0xNy4zIDUuNy0yNS45IDItOC42IDMuNy0xNy40IDUuMS0yNi4yIDIuNC0xMy43IDItMjUuNi0xLjItMzUuOS0zLTEwLjItOC4zLTE4LjktMTYtMjUuOS03LjQtNy0xNi42LTEyLjMtMjcuNC0xNS43LTEwLjctMy42LTIyLjMtNS40LTM1LTUuNC0yOS4zIDAtNTIuNyA3LTY5LjkgMjEuMXMtMjkuMiAzNC43LTM1LjkgNjEuOGMtMiA4LjgtNCAxNy42LTYgMjYuMi0xLjggOC42LTMuNSAxNy4zLTUuMSAyNS45LTIuMiAxMy43LTEuOCAyNS42IDEuMiAzNS45IDMuMiAxMC4yIDguNSAxOC44IDE2IDI1LjYgNy40IDYuOCAxNi42IDExLjkgMjcuNCAxNS40em02Ny44LTQ4Yy04LjIgNi40LTE3LjggOS42LTI4LjYgOS42LTExLjEgMC0xOS0zLjItMjMuOC05LjYtNC44LTYuNC02LTE2LjctMy42LTMwLjcgMS42LTguOCAzLjItMTcuMiA0LjgtMjUgMS44LTcuOCAzLjgtMTYgNi0yNC40IDMuNC0xNC4xIDkuMS0yNC4zIDE3LjItMzAuNyA4LjItNi40IDE3LjgtOS42IDI4LjYtOS42czE4LjggMy4yIDIzLjggOS42IDYuMiAxNi43IDMuNiAzMC43Yy0xLjQgOC40LTMgMTYuNi00LjggMjQuNC0xLjYgNy44LTMuNSAxNi4yLTUuNyAyNS0zLjQgMTQtOS4yIDI0LjMtMTcuNSAzMC43em05MS43IDQ4YzEuMiAxLjQgMi44IDIuMSA0LjggMi4xaDQxYzIuMiAwIDQuMS0uNyA1LjctMi4xIDEuOC0xLjQgMi45LTMuMiAzLjMtNS40bDEzLjktNjZoNDAuN2MyNS45IDAgNDYuNS01LjUgNjEuOC0xNi42IDE1LjUtMTEuMSAyNS43LTI4LjEgMzAuNy01MS4yIDIuNC0xMS43IDIuMy0yMS44LS4zLTMwLjQtMi42LTguOC03LjItMTYuMi0xMy45LTIyLTYuNi01LjgtMTUtMTAuMS0yNS0xMy05LjgtMi44LTIwLjktNC4yLTMzLjItNC4yaC04MC4yYy0yIDAtMy45LjctNS43IDIuMS0xLjggMS40LTIuOSAzLjItMy4zIDUuNEw1MDkgNjAzLjVjLS40IDIuMiAwIDQgMS4yIDUuNXptMTExLjItMTEzLjFoLTM0LjdsMTEuOC01NGgzNi4yYzcuMiAwIDEyLjYgMS4yIDE2IDMuNiAzLjYgMi40IDUuNyA1LjYgNi4zIDkuNi42IDQgLjQgOC42LS42IDEzLjktMiA5LTYuMyAxNS44LTEzIDIwLjItNi40IDQuNS0xMy44IDYuNy0yMiA2Ljd6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmMDQyMCIvPjwvc3ZnPg==",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Df.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:Df.wrapped.logo},stables:{usd:["0x94b008aA00579c1307B0EF2c499aD98a8ce58e58","0x7F5c764cBc14f9669B88837ca1490cCa17c31607"]},explorer:"https://optimistic.etherscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://optimistic.etherscan.io/tx/${t.id||t}`:e?`https://optimistic.etherscan.io/token/${e}`:n?`https://optimistic.etherscan.io/address/${n}`:void 0,endpoints:["https://optimism.blockpi.network/v1/rpc/public","https://optimism.meowrpc.com","https://optimism.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:Df.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:Df.wrapped.logo,type:"20"},{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x94b008aA00579c1307B0EF2c499aD98a8ce58e58/logo.png",type:"20"},{address:"0x7F5c764cBc14f9669B88837ca1490cCa17c31607",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x7F5c764cBc14f9669B88837ca1490cCa17c31607/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x4200000000000000000000000000000000000042",symbol:"OP",name:"Optimism",decimals:18,logo:"https://user-images.githubusercontent.com/1300064/219575413-d7990d69-1d21-44ef-a2b1-e9c682c79802.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};var Kf={name:"base",id:"0x2105",networkId:"8453",namespace:"eip155",label:"Base",fullName:"Base",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguNiA4NDJDNjg4IDg0MiA4NDIgNjg4LjkgODQyIDQ5OS41UzY4OCAxNTcgNDk4LjYgMTU3QzMxOSAxNTcgMTcxLjIgMjk1LjEgMTU3IDQ3MC4zaDQ1My4xdjU3LjVIMTU3QzE3MiA3MDMuOSAzMTkgODQyIDQ5OC42IDg0MnoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#0052FF",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguOSA4NDVDNjkwLjEgODQ1IDg0NSA2OTAuMyA4NDUgNDk5LjVTNjkwLjEgMTU0IDQ5OC45IDE1NEMzMTcuNiAxNTQgMTY4LjggMjkzLjMgMTU0IDQ3MC41aDQ1Ny40djU4LjFIMTU0QzE2OC44IDcwNS44IDMxNy42IDg0NSA0OTguOSA4NDV6IiBmaWxsPSIjMDA1MmZmIi8+PC9zdmc+",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Df.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:Df.wrapped.logo},stables:{usd:["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA"]},explorer:"https://basescan.org",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://basescan.org/tx/${t.id||t}`:e?`https://basescan.org/token/${e}`:n?`https://basescan.org/address/${n}`:void 0,endpoints:["https://base.blockpi.network/v1/rpc/public","https://base.meowrpc.com","https://mainnet.base.org"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:Df.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:Df.wrapped.logo,type:"20"},{address:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA",symbol:"USDbC",name:"USD Base Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const $f=[Df,Sf,Rf,Yf,Pf,Ff,Gf,Jf,Xf,Kf];var tp={ethereum:Df,bsc:Sf,polygon:Rf,solana:Yf,fantom:Pf,arbitrum:Ff,avalanche:Gf,gnosis:Jf,optimism:Xf,base:Kf,all:$f,findById:function(t){let e=t;return e.match("0x0")&&(e=e.replace(/0x0+/,"0x")),$f.find((t=>t.id&&t.id.toLowerCase()==e.toLowerCase()))},findByNetworkId:function(t){return t=t.toString(),$f.find((e=>e.networkId==t))},findByName:function(t){return $f.find((e=>e.name==t))}},ep="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function np(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function rp(t){var e={exports:{}};return t(e,e.exports),e.exports}for(var ip=function(t){var e=fp(t),n=e[0],r=e[1];return 3*(n+r)/4-r},op=function(t){var e,n,r=fp(t),i=r[0],o=r[1],a=new cp(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),s=0,u=o>0?i-4:i;for(n=0;n>16&255,a[s++]=e>>8&255,a[s++]=255&e;2===o&&(e=up[t.charCodeAt(n)]<<2|up[t.charCodeAt(n+1)]>>4,a[s++]=255&e);1===o&&(e=up[t.charCodeAt(n)]<<10|up[t.charCodeAt(n+1)]<<4|up[t.charCodeAt(n+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e);return a},ap=function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,a=0,s=n-r;as?s:a+o));1===r?(e=t[n-1],i.push(sp[e>>2]+sp[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(sp[e>>10]+sp[e>>4&63]+sp[e<<2&63]+"="));return i.join("")},sp=[],up=[],cp="undefined"!=typeof Uint8Array?Uint8Array:Array,lp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hp=0,dp=lp.length;hp0)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 pp(t,e,n){for(var r,i,o=[],a=e;a>18&63]+sp[i>>12&63]+sp[i>>6&63]+sp[63&i]);return o.join("")}up["-".charCodeAt(0)]=62,up["_".charCodeAt(0)]=63;var yp={byteLength:ip,toByteArray:op,fromByteArray:ap},mp=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},gp=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;t[n+f]=255&a,f+=p,a/=256,c-=8);t[n+f-p]|=128*y},vp=rp((function(t,e){const n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){+t!=t&&(t=0);return o.alloc(+t)},e.INSPECT_MAX_BYTES=50;const r=2147483647;function i(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|d(t,e);let r=i(n);const a=r.write(t,e);a!==n&&(r=r.slice(0,a));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(H(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(H(t,ArrayBuffer)||t&&H(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(H(t,SharedArrayBuffer)||t&&H(t.buffer,SharedArrayBuffer)))return l(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return o.from(r,e,n);const a=function(t){if(o.isBuffer(t)){const e=0|h(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||G(t.length)?i(0):c(t);if("Buffer"===t.type&&Array.isArray(t.data))return c(t.data)}(t);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return s(t),i(t<0?0:0|h(t))}function c(t){const e=t.length<0?0:0|h(t.length),n=i(e);for(let r=0;r=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function d(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||H(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(t).length;default:if(i)return r?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function f(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,n);case"utf8":case"utf-8":return N(this,e,n);case"ascii":return E(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function p(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:m(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):m(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,n,r,i){let o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){let r=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let a;for(r>o/2&&(r=o/2),a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?yp.fromByteArray(t):yp.fromByteArray(t.slice(e,n))}function N(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+a<=n){let n,r,s,u;switch(a){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],s=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(t){const e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(o.isBuffer(e)||(e=o.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!o.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},o.byteLength=d,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(t+=" ... "),""},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(t,e,n,r,i){if(H(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const u=Math.min(a,s),c=this.slice(r,i),l=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return g(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return w(this,t,e,n);case"base64":return b(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function E(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function S(t,e,n,r,i,a){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function j(t,e,n,r,i){R(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,n}function C(t,e,n,r,i){R(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=a,a>>=8,t[n+2]=a,a>>=8,t[n+1]=a,a>>=8,t[n]=a,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,4),gp(t,e,n,r,23,4),n+4}function z(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,8),gp(t,e,n,r,52,8),n+8}o.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readBigUInt64LE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||L(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readBigInt64LE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Q(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||L(t,4,this.length),mp(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),mp(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),mp(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),mp(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){S(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,!r){S(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigUInt64LE=Z((function(t,e=0){return j(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Z((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,t,e,n,r-1,-r)}let i=0,o=1,a=0;for(this[e]=255&t;++i>0)-a&255;return e+n},o.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,t,e,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/o>>0)-a&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigInt64LE=Z((function(t,e=0){return j(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Z((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(t,e,n){return O(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return O(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return z(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return z(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function R(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new P.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){U(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||Q(e,t.length-(n+1))}(r,i,o)}function U(t,e){if("number"!=typeof t)throw new P.ERR_INVALID_ARG_TYPE(e,"number",t)}function Q(t,e,n){if(Math.floor(t)!==t)throw U(t,n),new P.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new P.ERR_BUFFER_OUT_OF_BOUNDS;throw new P.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}_("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),_("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),_("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=B(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=B(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const Y=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let a=0;a55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.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;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(t){return yp.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(Y,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function H(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function G(t){return t!=t}const q=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}})),wp=rp((function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:vp.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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];i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.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;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 I(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){I.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return v[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,I),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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,ep)})); +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */let bp=!1,Mp=!1;const Ap={debug:1,default:2,info:2,warning:3,error:4,off:5};let Np=Ap.default,Ip=null;const Ep=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(n){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var xp,kp;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(xp||(xp={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(kp||(kp={}));const Tp="0123456789abcdef";class Lp{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();null==Ap[n]&&this.throwArgumentError("invalid log level name","logLevel",t),Np>Ap[n]||console.log.apply(console,e)}debug(...t){this._log(Lp.levels.DEBUG,t)}info(...t){this._log(Lp.levels.INFO,t)}warn(...t){this._log(Lp.levels.WARNING,t)}makeError(t,e,n){if(Mp)return this.makeError("censored error",e,{});e||(e=Lp.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((t=>{const e=n[t];try{if(e instanceof Uint8Array){let n="";for(let t=0;t>4],n+=Tp[15&e[t]];r.push(t+"=Uint8Array(0x"+n+")")}else r.push(t+"="+JSON.stringify(e))}catch(e){r.push(t+"="+JSON.stringify(n[t].toString()))}})),r.push(`code=${e}`),r.push(`version=${this.version}`);const i=t;let o="";switch(e){case kp.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case kp.CALL_EXCEPTION:case kp.INSUFFICIENT_FUNDS:case kp.MISSING_NEW:case kp.NONCE_EXPIRED:case kp.REPLACEMENT_UNDERPRICED:case kp.TRANSACTION_REPLACED:case kp.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(t+=" ("+r.join(", ")+")");const a=new Error(t);return a.reason=i,a.code=e,Object.keys(n).forEach((function(t){a[t]=n[t]})),a}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,Lp.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,r){t||this.throwError(e,n,r)}assertArgument(t,e,n,r){t||this.throwArgumentError(e,n,r)}checkNormalize(t){Ep&&this.throwError("platform missing String.prototype.normalize",Lp.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Ep})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Lp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Lp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",te&&this.throwError("too many arguments"+n,Lp.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Lp.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Lp.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Lp.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Ip||(Ip=new Lp("logger/5.7.0")),Ip}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Lp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),bp){if(!t)return;this.globalLogger().throwError("error censorship permanent",Lp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Mp=!!t,bp=!!e}static setLogLevel(t){const e=Ap[t.toLowerCase()];null!=e?Np=e:Lp.globalLogger().warn("invalid log level - "+t)}static from(t){return new Lp(t)}}Lp.errors=kp,Lp.levels=xp;const Sp=new Lp("bytes/5.7.0");function jp(t){return!!t.toHexString}function Cp(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Cp(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Dp(t){return Up(t)&&!(t.length%2)||zp(t)}function Op(t){return"number"==typeof t&&t==t&&t%1==0}function zp(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Op(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Pp(t,e){if(e||(e={}),"number"==typeof t){Sp.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Cp(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),jp(t)&&(t=t.toHexString()),Up(t)){let n=t.substring(2);n.length%2&&("left"===e.hexPad?n="0"+n:"right"===e.hexPad?n+="0":Sp.throwArgumentError("hex data is odd-length","value",t));const r=[];for(let t=0;tPp(t))),n=e.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(n);return e.reduce(((t,e)=>(r.set(e,t),t+e.length)),0),Cp(r)}function Bp(t){let e=Pp(t);if(0===e.length)return e;let n=0;for(;ne&&Sp.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(e);return n.set(t,e-t.length),Cp(n)}function Up(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const Qp="0123456789abcdef";function Yp(t,e){if(e||(e={}),"number"==typeof t){Sp.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Qp[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),jp(t))return t.toHexString();if(Up(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Sp.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(zp(t)){let e="0x";for(let n=0;n>4]+Qp[15&r]}return e}return Sp.throwArgumentError("invalid hexlify value","value",t)}function Wp(t){if("string"!=typeof t)t=Yp(t);else if(!Up(t)||t.length%2)return null;return(t.length-2)/2}function Fp(t,e,n){return"string"!=typeof t?t=Yp(t):(!Up(t)||t.length%2)&&Sp.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=n?"0x"+t.substring(e,2+2*n):"0x"+t.substring(e)}function Vp(t){let e="0x";return t.forEach((t=>{e+=Yp(t).substring(2)})),e}function Hp(t){const e=function(t){"string"!=typeof t&&(t=Yp(t));Up(t)||Sp.throwArgumentError("invalid hex string","value",t);t=t.substring(2);let e=0;for(;e2*e+2&&Sp.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function qp(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Dp(t)){let n=Pp(t);64===n.length?(e.v=27+(n[32]>>7),n[32]&=127,e.r=Yp(n.slice(0,32)),e.s=Yp(n.slice(32,64))):65===n.length?(e.r=Yp(n.slice(0,32)),e.s=Yp(n.slice(32,64)),e.v=n[64]):Sp.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:Sp.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(n[32]|=128),e._vs=Yp(n.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const n=Rp(Pp(e._vs),32);e._vs=Yp(n);const r=n[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=r:e.recoveryParam!==r&&Sp.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;const i=Yp(n);null==e.s?e.s=i:e.s!==i&&Sp.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?Sp.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const n=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==n&&Sp.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&Up(e.r)?e.r=Gp(e.r,32):Sp.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&Up(e.s)?e.s=Gp(e.s,32):Sp.throwArgumentError("signature missing or invalid s","signature",t);const n=Pp(e.s);n[0]>=128&&Sp.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(n[0]|=128);const r=Yp(n);e._vs&&(Up(e._vs)||Sp.throwArgumentError("signature invalid _vs","signature",t),e._vs=Gp(e._vs,32)),null==e._vs?e._vs=r:e._vs!==r&&Sp.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const Zp="bignumber/5.7.0";var Jp=wp.BN;const Xp=new Lp(Zp),Kp={},$p=9007199254740991;let ty=!1;class ey{constructor(t,e){t!==Kp&&Xp.throwError("cannot call constructor directly; use BigNumber.from",Lp.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return ry(iy(this).fromTwos(t))}toTwos(t){return ry(iy(this).toTwos(t))}abs(){return"-"===this._hex[0]?ey.from(this._hex.substring(1)):this}add(t){return ry(iy(this).add(iy(t)))}sub(t){return ry(iy(this).sub(iy(t)))}div(t){return ey.from(t).isZero()&&oy("division-by-zero","div"),ry(iy(this).div(iy(t)))}mul(t){return ry(iy(this).mul(iy(t)))}mod(t){const e=iy(t);return e.isNeg()&&oy("division-by-zero","mod"),ry(iy(this).umod(e))}pow(t){const e=iy(t);return e.isNeg()&&oy("negative-power","pow"),ry(iy(this).pow(e))}and(t){const e=iy(t);return(this.isNegative()||e.isNeg())&&oy("unbound-bitwise-result","and"),ry(iy(this).and(e))}or(t){const e=iy(t);return(this.isNegative()||e.isNeg())&&oy("unbound-bitwise-result","or"),ry(iy(this).or(e))}xor(t){const e=iy(t);return(this.isNegative()||e.isNeg())&&oy("unbound-bitwise-result","xor"),ry(iy(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&oy("negative-width","mask"),ry(iy(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&oy("negative-width","shl"),ry(iy(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&oy("negative-width","shr"),ry(iy(this).shrn(t))}eq(t){return iy(this).eq(iy(t))}lt(t){return iy(this).lt(iy(t))}lte(t){return iy(this).lte(iy(t))}gt(t){return iy(this).gt(iy(t))}gte(t){return iy(this).gte(iy(t))}isNegative(){return"-"===this._hex[0]}isZero(){return iy(this).isZero()}toNumber(){try{return iy(this).toNumber()}catch(t){oy("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Xp.throwError("this platform does not support BigInt",Lp.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?ty||(ty=!0,Xp.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Xp.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Lp.errors.UNEXPECTED_ARGUMENT,{}):Xp.throwError("BigNumber.toString does not accept parameters",Lp.errors.UNEXPECTED_ARGUMENT,{})),iy(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof ey)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new ey(Kp,ny(t)):t.match(/^-?[0-9]+$/)?new ey(Kp,ny(new Jp(t))):Xp.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&oy("underflow","BigNumber.from",t),(t>=$p||t<=-$p)&&oy("overflow","BigNumber.from",t),ey.from(String(t));const e=t;if("bigint"==typeof e)return ey.from(e.toString());if(zp(e))return ey.from(Yp(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return ey.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Up(t)||"-"===t[0]&&Up(t.substring(1))))return ey.from(t)}return Xp.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function ny(t){if("string"!=typeof t)return ny(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Xp.throwArgumentError("invalid hex","value",t),"0x00"===(t=ny(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function ry(t){return ey.from(ny(t))}function iy(t){const e=ey.from(t).toHexString();return"-"===e[0]?new Jp("-"+e.substring(3),16):new Jp(e.substring(2),16)}function oy(t,e,n){const r={fault:t,operation:e};return null!=n&&(r.value=n),Xp.throwError(t,Lp.errors.NUMERIC_FAULT,r)}const ay=new Lp(Zp),sy={},uy=ey.from(0),cy=ey.from(-1);function ly(t,e,n,r){const i={fault:e,operation:n};return void 0!==r&&(i.value=r),ay.throwError(t,Lp.errors.NUMERIC_FAULT,i)}let hy="0";for(;hy.length<256;)hy+=hy;function dy(t){if("number"!=typeof t)try{t=ey.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+hy.substring(0,t):ay.throwArgumentError("invalid decimal size","decimals",t)}function fy(t,e){null==e&&(e=0);const n=dy(e),r=(t=ey.from(t)).lt(uy);r&&(t=t.mul(cy));let i=t.mod(n).toString();for(;i.length2&&ay.throwArgumentError("too many decimal points","value",t);let o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>n.length-1&&ly("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.lengthnull==t[e]?r:(typeof t[e]!==n&&ay.throwArgumentError("invalid fixed format ("+e+" not "+n+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),n=i("width","number",n),r=i("decimals","number",r)}return n%8&&ay.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),r>80&&ay.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",r),new yy(sy,e,n,r)}}class my{constructor(t,e,n,r){t!==sy&&ay.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Lp.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=e,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&ay.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=py(this._value,this.format.decimals),n=py(t._value,t.format.decimals);return my.fromValue(e.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=py(this._value,this.format.decimals),n=py(t._value,t.format.decimals);return my.fromValue(e.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=py(this._value,this.format.decimals),n=py(t._value,t.format.decimals);return my.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=py(this._value,this.format.decimals),n=py(t._value,t.format.decimals);return my.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=my.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(e=e.subUnsafe(gy.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=my.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(e=e.addUnsafe(gy.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&ay.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const n=my.from("1"+hy.substring(0,t),this.format),r=vy.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(r).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){if(null==t)return this._hex;t%8&&ay.throwArgumentError("invalid byte width","width",t);return Gp(ey.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return my.fromString(this._value,t)}static fromValue(t,e,n){return null!=n||null==e||function(t){return null!=t&&(ey.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||Up(t)||"bigint"==typeof t||zp(t))}(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),my.fromString(fy(t,e),yy.from(n))}static fromString(t,e){null==e&&(e="fixed");const n=yy.from(e),r=py(t,n.decimals);!n.signed&&r.lt(uy)&&ly("unsigned value cannot be negative","overflow","value",t);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=Gp(i,n.width/8));const o=fy(r,n.decimals);return new my(sy,i,o,n)}static fromBytes(t,e){null==e&&(e="fixed");const n=yy.from(e);if(Pp(t).length>n.width/8)throw new Error("overflow");let r=ey.from(t);n.signed&&(r=r.fromTwos(n.width));const i=r.toTwos((n.signed?0:1)+n.width).toHexString(),o=fy(r,n.decimals);return new my(sy,i,o,n)}static from(t,e){if("string"==typeof t)return my.fromString(t,e);if(zp(t))return my.fromBytes(t,e);try{return my.fromValue(t,0,e)}catch(t){if(t.code!==Lp.errors.INVALID_ARGUMENT)throw t}return ay.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const gy=my.from(1),vy=my.from("0.5");var wy=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const by=new Lp("properties/5.7.0");function My(t,e,n){Object.defineProperty(t,e,{enumerable:!0,value:n,writable:!1})}function Ay(t,e){for(let n=0;n<32;n++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function Ny(t){return wy(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const n=t[e];return Promise.resolve(n).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function Iy(t){const e={};for(const n in t)e[n]=t[n];return e}const Ey={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function xy(t){if(null==t||Ey[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let n=0;nTy(t))));if("object"==typeof t){const e={};for(const n in t){const r=t[n];void 0!==r&&My(e,n,Ty(r))}return e}return by.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Ty(t){return ky(t)}class Ly{constructor(t){for(const e in t)this[e]=Ty(t[e])}}const Sy="abi/5.7.0",jy=new Lp(Sy),Cy={};let Dy={calldata:!0,memory:!0,storage:!0},Oy={calldata:!0,memory:!0};function zy(t,e){if("bytes"===t||"string"===t){if(Dy[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&Oy[e])return!0;return(Dy[e]||"payable"===e)&&jy.throwArgumentError("invalid modifier","name",e),!1}function Py(t,e){for(let n in e)My(t,n,e[n])}const _y=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),By=new RegExp(/^(.*)\[([0-9]*)\]$/);class Ry{constructor(t,e){t!==Cy&&jy.throwError("use fromString",Lp.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Py(this,e);let n=this.type.match(By);Py(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:Ry.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=_y.sighash),_y[t]||jy.throwArgumentError("invalid format type","format",t),t===_y.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==_y.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===_y.full?", ":",")+")"):e+=this.type,t!==_y.sighash&&(!0===this.indexed&&(e+=" indexed"),t===_y.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Ry.fromString(t,e):Ry.fromObject(t)}static fromObject(t){return Ry.isParamType(t)?t:new Ry(Cy,{name:t.name||null,type:Jy(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Ry.fromObject):null})}static fromString(t,e){return n=function(t,e){let n=t;function r(e){jy.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(t){let n={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(n.indexed=!1),n}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},a=o;for(let n=0;nRy.fromString(t,e)))}class Qy{constructor(t,e){t!==Cy&&jy.throwError("use a static from method",Lp.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Py(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return Qy.isFragment(t)?t:"string"==typeof t?Qy.fromString(t):Qy.fromObject(t)}static fromObject(t){if(Qy.isFragment(t))return t;switch(t.type){case"function":return Gy.fromObject(t);case"event":return Yy.fromObject(t);case"constructor":return Hy.fromObject(t);case"error":return Zy.fromObject(t);case"fallback":case"receive":return null}return jy.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Yy.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?Gy.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Hy.fromString(t.trim()):"error"===t.split(" ")[0]?Zy.fromString(t.substring(5).trim()):jy.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class Yy extends Qy{format(t){if(t||(t=_y.sighash),_y[t]||jy.throwArgumentError("invalid format type","format",t),t===_y.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==_y.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===_y.full?", ":",")+") ",t!==_y.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?Yy.fromString(t):Yy.fromObject(t)}static fromObject(t){if(Yy.isEventFragment(t))return t;"event"!==t.type&&jy.throwArgumentError("invalid event object","value",t);const e={name:Ky(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Ry.fromObject):[],type:"event"};return new Yy(Cy,e)}static fromString(t){let e=t.match($y);e||jy.throwArgumentError("invalid event string","value",t);let n=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":n=!0;break;case"":break;default:jy.warn("unknown modifier: "+t)}})),Yy.fromObject({name:e[1].trim(),anonymous:n,inputs:Uy(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function Wy(t,e){e.gas=null;let n=t.split("@");return 1!==n.length?(n.length>2&&jy.throwArgumentError("invalid human-readable ABI signature","value",t),n[1].match(/^[0-9]+$/)||jy.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=ey.from(n[1]),n[0]):t}function Fy(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function Vy(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&jy.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&jy.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||jy.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&jy.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&jy.throwArgumentError("unable to determine stateMutability","value",t),e}class Hy extends Qy{format(t){if(t||(t=_y.sighash),_y[t]||jy.throwArgumentError("invalid format type","format",t),t===_y.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===_y.sighash&&jy.throwError("cannot format a constructor for sighash",Lp.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===_y.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Hy.fromString(t):Hy.fromObject(t)}static fromObject(t){if(Hy.isConstructorFragment(t))return t;"constructor"!==t.type&&jy.throwArgumentError("invalid constructor object","value",t);let e=Vy(t);e.constant&&jy.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Ry.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?ey.from(t.gas):null};return new Hy(Cy,n)}static fromString(t){let e={type:"constructor"},n=(t=Wy(t,e)).match($y);return n&&"constructor"===n[1].trim()||jy.throwArgumentError("invalid constructor string","value",t),e.inputs=Uy(n[2].trim(),!1),Fy(n[3].trim(),e),Hy.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class Gy extends Hy{format(t){if(t||(t=_y.sighash),_y[t]||jy.throwArgumentError("invalid format type","format",t),t===_y.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==_y.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===_y.full?", ":",")+") ",t!==_y.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?Gy.fromString(t):Gy.fromObject(t)}static fromObject(t){if(Gy.isFunctionFragment(t))return t;"function"!==t.type&&jy.throwArgumentError("invalid function object","value",t);let e=Vy(t);const n={type:t.type,name:Ky(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Ry.fromObject):[],outputs:t.outputs?t.outputs.map(Ry.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?ey.from(t.gas):null};return new Gy(Cy,n)}static fromString(t){let e={type:"function"},n=(t=Wy(t,e)).split(" returns ");n.length>2&&jy.throwArgumentError("invalid function string","value",t);let r=n[0].match($y);if(r||jy.throwArgumentError("invalid function signature","value",t),e.name=r[1].trim(),e.name&&Ky(e.name),e.inputs=Uy(r[2],!1),Fy(r[3].trim(),e),n.length>1){let r=n[1].match($y);""==r[1].trim()&&""==r[3].trim()||jy.throwArgumentError("unexpected tokens","value",t),e.outputs=Uy(r[2],!1)}else e.outputs=[];return Gy.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function qy(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||jy.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class Zy extends Qy{format(t){if(t||(t=_y.sighash),_y[t]||jy.throwArgumentError("invalid format type","format",t),t===_y.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==_y.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===_y.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?Zy.fromString(t):Zy.fromObject(t)}static fromObject(t){if(Zy.isErrorFragment(t))return t;"error"!==t.type&&jy.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:Ky(t.name),inputs:t.inputs?t.inputs.map(Ry.fromObject):[]};return qy(new Zy(Cy,e))}static fromString(t){let e={type:"error"},n=t.match($y);return n||jy.throwArgumentError("invalid error signature","value",t),e.name=n[1].trim(),e.name&&Ky(e.name),e.inputs=Uy(n[2],!1),qy(Zy.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function Jy(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const Xy=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ky(t){return t&&t.match(Xy)||jy.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const $y=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const tm=new Lp(Sy);class em{constructor(t,e,n,r){this.name=t,this.type=e,this.localName=n,this.dynamic=r}_throwError(t,e){tm.throwArgumentError(t,this.localName,e)}}class nm{constructor(t){My(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return Vp(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(_p(t._data))}writeBytes(t){let e=Pp(t);const n=e.length%this.wordSize;return n&&(e=_p([e,this._padding.slice(n)])),this._writeData(e)}_getValue(t){let e=Pp(ey.from(t));return e.length>this.wordSize&&tm.throwError("value out-of-bounds",Lp.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=_p([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class rm{constructor(t,e,n,r){My(this,"_data",Pp(t)),My(this,"wordSize",e||32),My(this,"_coerceFunc",n),My(this,"allowLoose",r),this._offset=0}get data(){return Yp(this._data)}get consumed(){return this._offset}static coerce(t,e){let n=t.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):rm.coerce(t,e)}_peekBytes(t,e,n){let r=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&(this.allowLoose&&n&&this._offset+e<=this._data.length?r=e:tm.throwError("data out-of-bounds",Lp.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r})),this._data.slice(this._offset,this._offset+r)}subReader(t){return new rm(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let n=this._peekBytes(0,t,!!e);return this._offset+=n.length,n.slice(0,t)}readValue(){return ey.from(this.readBytes(this.wordSize))}}var im=rp((function(t){!function(){var e="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof k&&k.versions&&k.versions.node?r=ep:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&t.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),u=[4,1024,262144,67108864],c=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],d=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var y=function(t,e,n){return function(r){return new j(t,e,t).update(r)[n]()}},m=function(t,e,n){return function(r,i){return new j(t,e,i).update(r)[n]()}},g=function(t,e,n){return function(e,r,i,o){return A["cshake"+t].update(e,r,i,o)[n]()}},v=function(t,e,n){return function(e,r,i,o){return A["kmac"+t].update(e,r,i,o)[n]()}},w=function(t,e,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function C(t,e,n){j.call(this,t,e,n)}j.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}for(var i,o,s=this.blocks,u=this.byteCount,l=t.length,h=this.blockCount,d=0,f=this.s;d>2]|=t[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(s[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=u){for(this.start=i-u,this.block=s[h],i=0;i>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},j.prototype.encodeString=function(t){var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}var i=0,o=t.length;if(n)i=o;else for(var s=0;s=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},j.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e>4&15]+s[15&t]+s[t>>12&15]+s[t>>8&15]+s[t>>20&15]+s[t>>16&15]+s[t>>28&15]+s[t>>24&15];a%e==0&&(D(n),o=0)}return i&&(t=n[o],u+=s[t>>4&15]+s[15&t],i>1&&(u+=s[t>>12&15]+s[t>>8&15]),i>2&&(u+=s[t>>20&15]+s[t>>16&15])),u},j.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&D(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},C.prototype=new j,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),j.prototype.finalize.call(this)};var D=function(t){var e,n,r,i,o,a,s,u,c,h,d,f,p,y,m,g,v,w,b,M,A,N,I,E,x,k,T,L,S,j,C,D,O,z,P,_,B,R,U,Q,Y,W,F,V,H,G,q,Z,J,X,K,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(h<<1|d>>>31),n=s^(d<<1|h>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=h^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,y=t[0],m=t[1],G=t[11]<<4|t[10]>>>28,q=t[10]<<4|t[11]>>>28,L=t[20]<<3|t[21]>>>29,S=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,W=t[40]<<18|t[41]>>>14,F=t[41]<<18|t[40]>>>14,z=t[2]<<1|t[3]>>>31,P=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,Z=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,j=t[33]<<13|t[32]>>>19,C=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,_=t[14]<<6|t[15]>>>26,B=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,K=t[35]<<15|t[34]>>>17,D=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,E=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,R=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,H=t[9]<<27|t[8]>>>5,k=t[18]<<20|t[19]>>>12,T=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,Q=t[38]<<8|t[39]>>>24,Y=t[39]<<8|t[38]>>>24,N=t[48]<<14|t[49]>>>18,I=t[49]<<14|t[48]>>>18,t[0]=y^~g&w,t[1]=m^~v&b,t[10]=E^~k&L,t[11]=x^~T&S,t[20]=z^~_&R,t[21]=P^~B&U,t[30]=V^~G&Z,t[31]=H^~q&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=g^~w&M,t[3]=v^~b&A,t[12]=k^~L&j,t[13]=T^~S&C,t[22]=_^~R&Q,t[23]=B^~U&Y,t[32]=G^~Z&X,t[33]=q^~J&K,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=w^~M&N,t[5]=b^~A&I,t[14]=L^~j&D,t[15]=S^~C&O,t[24]=R^~Q&W,t[25]=U^~Y&F,t[34]=Z^~X&$,t[35]=J^~K&tt,t[44]=ot^~st&ct,t[45]=at^~ut<,t[6]=M^~N&y,t[7]=A^~I&m,t[16]=j^~D&E,t[17]=C^~O&x,t[26]=Q^~W&z,t[27]=Y^~F&P,t[36]=X^~$&V,t[37]=K^~tt&H,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=N^~y&g,t[9]=I^~m&v,t[18]=D^~E&k,t[19]=O^~x&T,t[28]=W^~z&_,t[29]=F^~P&B,t[38]=$^~V&G,t[39]=tt^~H&q,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=l[r],t[1]^=l[r+1]};if(o)t.exports=A;else for(I=0;I>=8;return e}function um(t,e,n){let r=0;for(let i=0;ie+1+r&&am.throwError("child data too short",Lp.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function dm(t,e){if(0===t.length&&am.throwError("data too short",Lp.errors.BUFFER_OVERRUN,{}),t[e]>=248){const n=t[e]-247;e+1+n>t.length&&am.throwError("data short segment too short",Lp.errors.BUFFER_OVERRUN,{});const r=um(t,e+1,n);return e+1+n+r>t.length&&am.throwError("data long segment too short",Lp.errors.BUFFER_OVERRUN,{}),hm(t,e,e+1+n,n+r)}if(t[e]>=192){const n=t[e]-192;return e+1+n>t.length&&am.throwError("data array too short",Lp.errors.BUFFER_OVERRUN,{}),hm(t,e,e+1,n)}if(t[e]>=184){const n=t[e]-183;e+1+n>t.length&&am.throwError("data array too short",Lp.errors.BUFFER_OVERRUN,{});const r=um(t,e+1,n);e+1+n+r>t.length&&am.throwError("data array too short",Lp.errors.BUFFER_OVERRUN,{});return{consumed:1+n+r,result:Yp(t.slice(e+1+n,e+1+n+r))}}if(t[e]>=128){const n=t[e]-128;e+1+n>t.length&&am.throwError("data too short",Lp.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:Yp(t.slice(e+1,e+1+n))}}return{consumed:1,result:Yp(t[e])}}function fm(t){const e=Pp(t),n=dm(e,0);return n.consumed!==e.length&&am.throwArgumentError("invalid rlp data","data",t),n.result}const pm=new Lp("address/5.7.0");function ym(t){Up(t,20)||pm.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let t=0;t<40;t++)n[t]=e[t].charCodeAt(0);const r=Pp(om(n));for(let t=0;t<40;t+=2)r[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&r[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const mm={};for(let t=0;t<10;t++)mm[String(t)]=String(t);for(let t=0;t<26;t++)mm[String.fromCharCode(65+t)]=String(10+t);const gm=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function vm(t){let e=null;if("string"!=typeof t&&pm.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=ym(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&pm.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>mm[t])).join("");for(;e.length>=gm;){let t=e.substring(0,gm);e=parseInt(t,10)%97+e.substring(t.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}(t)&&pm.throwArgumentError("bad icap checksum","address",t),n=t.substring(4),e=new Jp(n,36).toString(16);e.length<40;)e="0"+e;e=ym("0x"+e)}else pm.throwArgumentError("invalid address","address",t);var n;return e}function wm(t){let e=null;try{e=vm(t.from)}catch(e){pm.throwArgumentError("missing from address","transaction",t)}return vm(Fp(om(lm([e,Bp(Pp(ey.from(t.nonce).toHexString()))])),12))}class bm extends em{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=vm(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return vm(Gp(t.readValue().toHexString(),20))}}class Mm extends em{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const Am=new Lp(Sy);function Nm(t,e,n){let r=null;if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let t={};r=e.map((e=>{const r=e.localName;return r||Am.throwError("cannot encode object for signature with missing names",Lp.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[r]&&Am.throwError("cannot encode object for signature with duplicate names",Lp.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[r]=!0,n[r]}))}else Am.throwArgumentError("invalid tuple value","tuple",n);e.length!==r.length&&Am.throwArgumentError("types/value length mismatch","tuple",n);let i=new nm(t.wordSize),o=new nm(t.wordSize),a=[];e.forEach(((t,e)=>{let n=r[e];if(t.dynamic){let e=o.length;t.encode(o,n);let r=i.writeUpdatableValue();a.push((t=>{r(t+e)}))}else t.encode(i,n)})),a.forEach((t=>{t(i.length)}));let s=t.appendWriter(i);return s+=t.appendWriter(o),s}function Im(t,e){let n=[],r=t.subReader(0);e.forEach((e=>{let i=null;if(e.dynamic){let n=t.readValue(),o=r.subReader(n.toNumber());try{i=e.decode(o)}catch(t){if(t.code===Lp.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===Lp.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&n.push(i)}));const i=e.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});e.forEach(((t,e)=>{let r=t.localName;if(!r||1!==i[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const o=n[e];o instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw o}}):n[r]=o}));for(let t=0;t{throw e}})}return Object.freeze(n)}class Em extends em{constructor(t,e,n){super("array",t.type+"["+(e>=0?e:"")+"]",n,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let n=0;nt._data.length&&Am.throwError("insufficient data length",Lp.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let n=[];for(let t=0;t>6==2;r++)t++;return t}return t===Bm.OVERRUN?n.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(_m||(_m={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Bm||(Bm={}));const Um=Object.freeze({error:function(t,e,n,r,i){return Pm.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",n)},ignore:Rm,replace:function(t,e,n,r,i){return t===Bm.OVERLONG?(r.push(i),0):(r.push(65533),Rm(t,e,n))}});function Qm(t,e){null==e&&(e=Um.error),t=Pp(t);const n=[];let r=0;for(;r>7==0){n.push(i);continue}let o=null,a=null;if(192==(224&i))o=1,a=127;else if(224==(240&i))o=2,a=2047;else{if(240!=(248&i)){r+=e(128==(192&i)?Bm.UNEXPECTED_CONTINUE:Bm.BAD_PREFIX,r-1,t,n);continue}o=3,a=65535}if(r-1+o>=t.length){r+=e(Bm.OVERRUN,r-1,t,n);continue}let s=i&(1<<8-o-1)-1;for(let i=0;i1114111?r+=e(Bm.OUT_OF_RANGE,r-1-o,t,n,s):s>=55296&&s<=57343?r+=e(Bm.UTF16_SURROGATE,r-1-o,t,n,s):s<=a?r+=e(Bm.OVERLONG,r-1-o,t,n,s):n.push(s))}return n}function Ym(t,e=_m.current){e!=_m.current&&(Pm.checkNormalize(),t=t.normalize(e));let n=[];for(let e=0;e>6|192),n.push(63&r|128);else if(55296==(64512&r)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&r)<<10)+(1023&i);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return Pp(n)}function Wm(t,e){return Qm(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}class Fm extends km{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Ym(e))}decode(t){return Wm(super.decode(t))}}class Vm extends em{constructor(t,e){let n=!1;const r=[];t.forEach((t=>{t.dynamic&&(n=!0),r.push(t.type)}));super("tuple","tuple("+r.join(",")+")",e,n),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});return this.coders.forEach(((n,r)=>{let i=n.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[r]))})),Object.freeze(t)}encode(t,e){return Nm(t,this.coders,e)}decode(t){return t.coerce(this.name,Im(t,this.coders))}}const Hm=new Lp(Sy),Gm=new RegExp(/^bytes([0-9]*)$/),qm=new RegExp(/^(u?int)([0-9]*)$/);const Zm=new class{constructor(t){My(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new bm(t.name);case"bool":return new xm(t.name);case"string":return new Fm(t.name);case"bytes":return new Tm(t.name);case"array":return new Em(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new Vm((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new Sm(t.name)}let e=t.type.match(qm);if(e){let n=parseInt(e[2]||"256");return(0===n||n>256||n%8!=0)&&Hm.throwArgumentError("invalid "+e[1]+" bit length","param",t),new zm(n/8,"int"===e[1],t.name)}if(e=t.type.match(Gm),e){let n=parseInt(e[1]);return(0===n||n>32)&&Hm.throwArgumentError("invalid bytes length","param",t),new Lm(n,t.name)}return Hm.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new rm(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new nm(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(Ry.from(t))));return new Vm(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&Hm.throwError("types/values length mismatch",Lp.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const n=t.map((t=>this._getCoder(Ry.from(t)))),r=new Vm(n,"_"),i=this._getWriter();return r.encode(i,e),i.data}decode(t,e,n){const r=t.map((t=>this._getCoder(Ry.from(t))));return new Vm(r,"_").decode(this._getReader(Pp(e),n))}};function Jm(t){return om(Ym(t))}const Xm="hash/5.7.0";function Km(t){t=atob(t);const e=[];for(let n=0;n0&&Array.isArray(t)?i(t,e-1):n.push(t)}))};return i(t,e),n}function eg(t){return function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),i=1,o=[0,1];for(let t=1;t>--u&1}const h=Math.pow(2,31),d=h>>>1,f=d>>1,p=h-1;let y=0;for(let t=0;t<31;t++)y=y<<1|l();let m=[],g=0,v=h;for(;;){let t=Math.floor(((y-g+1)*i-1)/v),e=0,n=r;for(;n-e>1;){let r=e+n>>>1;t>>1|l(),a=a<<1^d,s=(s^d)<<1|d|1;g=a,v=1+s-a}let w=r-4;return m.map((e=>{switch(e-w){case 3:return w+65792+(t[s++]<<16|t[s++]<<8|t[s++]);case 2:return w+256+(t[s++]<<8|t[s++]);case 1:return w+t[s++];default:return e-1}}))}(t))}function ng(t){return 1&t?~t>>1:t>>1}function rg(t,e){let n=Array(t);for(let r=0,i=-1;re[t])):n}function ag(t,e,n){let r=Array(t).fill(void 0).map((()=>[]));for(let i=0;ir[e].push(t)));return r}function sg(t,e){let n=1+e(),r=e(),i=function(t){let e=[];for(;;){let n=t();if(0==n)break;e.push(n)}return e}(e);return tg(ag(i.length,1+t,e).map(((t,e)=>{const o=t[0],a=t.slice(1);return Array(i[e]).fill(void 0).map(((t,e)=>{let i=e*r;return[o+e*n,a.map((t=>t+i))]}))})))}function ug(t,e){return ag(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}const cg=eg(Km("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),lg=new Set(og(cg)),hg=new Set(og(cg)),dg=function(t){let e=[];for(;;){let n=t();if(0==n)break;e.push(sg(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(ug(n,t))}return function(t){const e={};for(let n=0;nt-e));return function n(){let r=[];for(;;){let i=og(t,e);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort(((t,e)=>e.set.size-t.set.size));let i=t(),o=i%3;i=i/3|0;let a=!!(1&i);return i>>=1,{branches:r,valid:o,fe0f:a,save:1==i,check:2==i}}()}(cg);function pg(t){return function(t,e=_m.current){return Qm(Ym(t,e))}(t)}function yg(t){return t.filter((t=>65039!=t))}function mg(t){for(let e of t.split(".")){let t=pg(e);try{for(let e=t.lastIndexOf(95)-1;e>=0;e--)if(95!==t[e])throw new Error("underscore only allowed at start");if(t.length>=4&&t.every((t=>t<128))&&45===t[2]&&45===t[3])throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${e}": ${t.message}`)}}return t}function gg(t){return mg(function(t,e){let n=pg(t).reverse(),r=[];for(;n.length;){let t=vg(n);if(t){r.push(...e(t));continue}let i=n.pop();if(lg.has(i)){r.push(i);continue}if(hg.has(i))continue;let o=dg[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);r.push(...o)}return mg(function(t){return t.normalize("NFC")}(String.fromCodePoint(...r)))}(t,yg))}function vg(t,e){var n;let r,i,o=fg,a=[],s=t.length;for(e&&(e.length=0);s;){let u=t[--s];if(o=null===(n=o.branches.find((t=>t.set.has(u))))||void 0===n?void 0:n.node,!o)break;if(o.save)i=u;else if(o.check&&u===i)break;a.push(u),o.fe0f&&(a.push(65039),s>0&&65039==t[s-1]&&s--),o.valid&&(r=a.slice(),2==o.valid&&r.splice(1,1),e&&e.push(...t.slice(s).reverse()),t.length=s)}return r}const wg=new Lp(Xm),bg=new Uint8Array(32);function Mg(t){if(0===t.length)throw new Error("invalid ENS name; empty component");return t}function Ag(t){const e=Ym(gg(t)),n=[];if(0===t.length)return n;let r=0;for(let t=0;t=e.length)throw new Error("invalid ENS name; empty component");return n.push(Mg(e.slice(r))),n}function Ng(t){"string"!=typeof t&&wg.throwArgumentError("invalid ENS name; not a string","name",t);let e=bg;const n=Ag(t);for(;n.length;)e=om(_p([e,om(n.pop())]));return Yp(e)}bg.fill(0);var Ig=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const Eg=new Lp(Xm),xg=new Uint8Array(32);xg.fill(0);const kg=ey.from(-1),Tg=ey.from(0),Lg=ey.from(1),Sg=ey.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const jg=Gp(Lg.toHexString(),32),Cg=Gp(Tg.toHexString(),32),Dg={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Og=["name","version","chainId","verifyingContract","salt"];function zg(t){return function(e){return"string"!=typeof e&&Eg.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Pg={name:zg("name"),version:zg("version"),chainId:function(t){try{return ey.from(t).toString()}catch(t){}return Eg.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return vm(t).toLowerCase()}catch(t){}return Eg.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=Pp(t);if(32!==e.length)throw new Error("bad length");return Yp(e)}catch(t){}return Eg.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function _g(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const n=""===e[1],r=parseInt(e[2]||"256");(r%8!=0||r>256||e[2]&&e[2]!==String(r))&&Eg.throwArgumentError("invalid numeric width","type",t);const i=Sg.mask(n?r-1:r),o=n?i.add(Lg).mul(kg):Tg;return function(e){const n=ey.from(e);return(n.lt(o)||n.gt(i))&&Eg.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),Gp(n.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return(0===n||n>32||e[1]!==String(n))&&Eg.throwArgumentError("invalid bytes width","type",t),function(e){return Pp(e).length!==n&&Eg.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=Pp(t),n=e.length%32;return n?Vp([e,xg.slice(n)]):Yp(e)}(e)}}}switch(t){case"address":return function(t){return Gp(vm(t),32)};case"bool":return function(t){return t?jg:Cg};case"bytes":return function(t){return om(t)};case"string":return function(t){return Jm(t)}}return null}function Bg(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class Rg{constructor(t){My(this,"types",Object.freeze(Ty(t))),My(this,"_encoderCache",{}),My(this,"_types",{});const e={},n={},r={};Object.keys(t).forEach((t=>{e[t]={},n[t]=[],r[t]={}}));for(const r in t){const i={};t[r].forEach((o=>{i[o.name]&&Eg.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(r)}`,"types",t),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===r&&Eg.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t);_g(a)||(n[a]||Eg.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",t),n[a].push(r),e[r][a]=!0)}))}const i=Object.keys(n).filter((t=>0===n[t].length));0===i.length?Eg.throwArgumentError("missing primary type","types",t):i.length>1&&Eg.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),My(this,"primaryType",i[0]),function i(o,a){a[o]&&Eg.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),a[o]=!0,Object.keys(e[o]).forEach((t=>{n[t]&&(i(t,a),Object.keys(a).forEach((e=>{r[e][t]=!0})))})),delete a[o]}(this.primaryType,{});for(const e in r){const n=Object.keys(r[e]);n.sort(),this._types[e]=Bg(e,t[e])+n.map((e=>Bg(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=_g(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],n=this.getEncoder(t),r=parseInt(e[3]);return e=>{r>=0&&e.length!==r&&Eg.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(n);return this._types[t]&&(i=i.map(om)),om(Vp(i))}}const n=this.types[t];if(n){const e=Jm(this._types[t]);return t=>{const r=n.map((({name:e,type:n})=>{const r=this.getEncoder(n)(t[e]);return this._types[n]?om(r):r}));return r.unshift(e),Vp(r)}}return Eg.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||Eg.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return om(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,n){if(_g(t))return n(t,e);const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const t=r[1],i=parseInt(r[3]);return i>=0&&e.length!==i&&Eg.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,n)))}const i=this.types[t];return i?i.reduce(((t,{name:r,type:i})=>(t[r]=this._visit(i,e[r],n),t)),{}):Eg.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new Rg(t)}static getPrimaryType(t){return Rg.from(t).primaryType}static hashStruct(t,e,n){return Rg.from(e).hashStruct(t,n)}static hashDomain(t){const e=[];for(const n in t){const r=Dg[n];r||Eg.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),e.push({name:n,type:r})}return e.sort(((t,e)=>Og.indexOf(t.name)-Og.indexOf(e.name))),Rg.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,n){return Vp(["0x1901",Rg.hashDomain(t),Rg.from(e).hash(n)])}static hash(t,e,n){return om(Rg.encode(t,e,n))}static resolveNames(t,e,n,r){return Ig(this,void 0,void 0,(function*(){t=Iy(t);const i={};t.verifyingContract&&!Up(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=Rg.from(e);o.visit(n,((t,e)=>("address"!==t||Up(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield r(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),n=o.visit(n,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:n}}))}static getPayload(t,e,n){Rg.hashDomain(t);const r={},i=[];Og.forEach((e=>{const n=t[e];null!=n&&(r[e]=Pg[e](n),i.push({name:e,type:Dg[e]}))}));const o=Rg.from(e),a=Iy(e);return a.EIP712Domain?Eg.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):a.EIP712Domain=i,o.encode(n),{types:a,domain:r,primaryType:o.primaryType,message:o.visit(n,((t,e)=>{if(t.match(/^bytes(\d*)/))return Yp(Pp(e));if(t.match(/^u?int/))return ey.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&Eg.throwArgumentError("invalid string","value",e),e}return Eg.throwArgumentError("unsupported type","type",t)}))}}}const Ug=new Lp(Sy);class Qg extends Ly{}class Yg extends Ly{}class Wg extends Ly{}class Fg extends Ly{static isIndexed(t){return!(!t||!t._isIndexed)}}const Vg={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Hg(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return n.error=e,n}class Gg{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,My(this,"fragments",e.map((t=>Qy.from(t))).filter((t=>null!=t))),My(this,"_abiCoder",Ay(new.target,"getAbiCoder")()),My(this,"functions",{}),My(this,"errors",{}),My(this,"events",{}),My(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void Ug.warn("duplicate definition - constructor"):void My(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let n=t.format();e[n]?Ug.warn("duplicate definition - "+n):e[n]=t})),this.deploy||My(this,"deploy",Hy.from({payable:!1,type:"constructor"})),My(this,"_isInterface",!0)}format(t){t||(t=_y.full),t===_y.sighash&&Ug.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===_y.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return Zm}static getAddress(t){return vm(t)}static getSighash(t){return Fp(Jm(t.format()),0,4)}static getEventTopic(t){return Jm(t.format())}getFunction(t){if(Up(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];Ug.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===n.length?Ug.throwArgumentError("no matching function","name",e):n.length>1&&Ug.throwArgumentError("multiple matching functions","name",e),this.functions[n[0]]}const e=this.functions[Gy.fromString(t).format()];return e||Ug.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(Up(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];Ug.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===n.length?Ug.throwArgumentError("no matching event","name",e):n.length>1&&Ug.throwArgumentError("multiple matching events","name",e),this.events[n[0]]}const e=this.events[Yy.fromString(t).format()];return e||Ug.throwArgumentError("no matching event","signature",t),e}getError(t){if(Up(t)){const e=Ay(this.constructor,"getSighash");for(const n in this.errors){if(t===e(this.errors[n]))return this.errors[n]}Ug.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===n.length?Ug.throwArgumentError("no matching error","name",e):n.length>1&&Ug.throwArgumentError("multiple matching errors","name",e),this.errors[n[0]]}const e=this.errors[Gy.fromString(t).format()];return e||Ug.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return Ay(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),Ay(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const n=Pp(e);return Yp(n.slice(0,4))!==this.getSighash(t)&&Ug.throwArgumentError(`data signature does not match error ${t.name}.`,"data",Yp(n)),this._decodeParams(t.inputs,n.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),Yp(_p([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const n=Pp(e);return Yp(n.slice(0,4))!==this.getSighash(t)&&Ug.throwArgumentError(`data signature does not match function ${t.name}.`,"data",Yp(n)),this._decodeParams(t.inputs,n.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),Yp(_p([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let n=Pp(e),r=null,i="",o=null,a=null,s=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,n)}catch(t){}break;case 4:{const t=Yp(n.slice(0,4)),e=Vg[t];if(e)o=this._abiCoder.decode(e.inputs,n.slice(4)),a=e.name,s=e.signature,e.reason&&(r=o[0]),"Error"===a?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===a&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const e=this.getError(t);o=this._abiCoder.decode(e.inputs,n.slice(4)),a=e.name,s=e.format()}catch(t){}break}}return Ug.throwError("call revert exception"+i,Lp.errors.CALL_EXCEPTION,{method:t.format(),data:Yp(e),errorArgs:o,errorName:a,errorSignature:s,reason:r})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),Yp(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&Ug.throwError("too many arguments for "+t.format(),Lp.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let n=[];t.anonymous||n.push(this.getEventTopic(t));const r=(t,e)=>"string"===t.type?Jm(e):"bytes"===t.type?om(Yp(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=ey.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),Gp(Yp(e),32));for(e.forEach(((e,i)=>{let o=t.inputs[i];o.indexed?null==e?n.push(null):"array"===o.baseType||"tuple"===o.baseType?Ug.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?n.push(e.map((t=>r(o,t)))):n.push(r(o,e)):null!=e&&Ug.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const n=[],r=[],i=[];return t.anonymous||n.push(this.getEventTopic(t)),e.length!==t.inputs.length&&Ug.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const a=e[o];if(t.indexed)if("string"===t.type)n.push(Jm(a));else if("bytes"===t.type)n.push(om(a));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");n.push(this._abiCoder.encode([t.type],[a]))}else r.push(t),i.push(a)})),{data:this._abiCoder.encode(r,i),topics:n}}decodeEventLog(t,e,n){if("string"==typeof t&&(t=this.getEvent(t)),null!=n&&!t.anonymous){let e=this.getEventTopic(t);Up(n[0],32)&&n[0].toLowerCase()===e||Ug.throwError("fragment/topic mismatch",Lp.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:n[0]}),n=n.slice(1)}let r=[],i=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(r.push(Ry.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(r.push(t),o.push(!1)):(i.push(t),o.push(!1))}));let a=null!=n?this._abiCoder.decode(r,_p(n)):null,s=this._abiCoder.decode(i,e,!0),u=[],c=0,l=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==a)u[e]=new Fg({_isIndexed:!0,hash:null});else if(o[e])u[e]=new Fg({_isIndexed:!0,hash:a[l++]});else try{u[e]=a[l++]}catch(t){u[e]=t}else try{u[e]=s[c++]}catch(t){u[e]=t}if(t.name&&null==u[t.name]){const n=u[e];n instanceof Error?Object.defineProperty(u,t.name,{enumerable:!0,get:()=>{throw Hg(`property ${JSON.stringify(t.name)}`,n)}}):u[t.name]=n}}));for(let t=0;t{throw Hg(`index ${t}`,e)}})}return Object.freeze(u)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new Yg({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:ey.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new Qg({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=Yp(t);let n=this.getError(e.substring(0,10).toLowerCase());return n?new Wg({args:this._abiCoder.decode(n.inputs,"0x"+e.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(t){return!(!t||!t._isInterface)}}var qg=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const Zg=new Lp("abstract-provider/5.7.0");class Jg extends Ly{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class Xg{constructor(){Zg.checkAbstract(new.target,Xg),My(this,"_isProvider",!0)}getFeeData(){return qg(this,void 0,void 0,(function*(){const{block:t,gasPrice:e}=yield Ny({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((t=>null))});let n=null,r=null,i=null;return t&&t.baseFeePerGas&&(n=t.baseFeePerGas,i=ey.from("1500000000"),r=t.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:n,maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:e}}))}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}var Kg=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const $g=new Lp("abstract-signer/5.7.0"),tv=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],ev=[Lp.errors.INSUFFICIENT_FUNDS,Lp.errors.NONCE_EXPIRED,Lp.errors.REPLACEMENT_UNDERPRICED];class nv{constructor(){$g.checkAbstract(new.target,nv),My(this,"_isSigner",!0)}getBalance(t){return Kg(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return Kg(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return Kg(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield Ny(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return Kg(this,void 0,void 0,(function*(){this._checkProvider("call");const n=yield Ny(this.checkTransaction(t));return yield this.provider.call(n,e)}))}sendTransaction(t){return Kg(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),n=yield this.signTransaction(e);return yield this.provider.sendTransaction(n)}))}getChainId(){return Kg(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return Kg(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return Kg(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return Kg(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===tv.indexOf(e)&&$g.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=Iy(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&$g.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return Kg(this,void 0,void 0,(function*(){const e=yield Ny(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>Kg(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&$g.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const n=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!n?0!==e.type&&1!==e.type||!n||$g.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):$g.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(n&&$g.throwError("network does not support EIP-1559",Lp.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):$g.throwError("failed to get consistent fee data",Lp.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(ev.indexOf(t.code)>=0)throw t;return $g.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Lp.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&$g.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield Ny(e)}))}_checkProvider(t){this.provider||$g.throwError("missing provider",Lp.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class rv extends nv{constructor(t,e){super(),My(this,"address",t),My(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{$g.throwError(t,Lp.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new rv(this.address,t)}}var iv=rp((function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:vp.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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];i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.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;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 I(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){I.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new N}return v[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,I),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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,ep)})),ov=av;function av(t,e){if(!t)throw new Error(e||"Assertion failed")}av.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var sv=[],uv=[],cv="undefined"!=typeof Uint8Array?Uint8Array:Array,lv=!1;function hv(){lv=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,n=t.length;e>18&63]+sv[i>>12&63]+sv[i>>6&63]+sv[63&i]);return o.join("")}function fv(t){var e;lv||hv();for(var n=t.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;su?u:s+a));return 1===r?(e=t[n-1],i+=sv[e>>2],i+=sv[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=sv[e>>10],i+=sv[e>>4&63],i+=sv[e<<2&63],i+="="),o.push(i),o.join("")}function pv(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)}function yv(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;t[n+f]=255&a,f+=p,a/=256,c-=8);t[n+f-p]|=128*y}var mv={}.toString,gv=Array.isArray||function(t){return"[object Array]"==mv.call(t)};function vv(){return bv.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function wv(t,e){if(vv()=vv())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+vv().toString(16)+" bytes");return 0|t}function xv(t){return!(null==t||!t._isBuffer)}function kv(t,e){if(xv(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return tw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ew(t).length;default:if(r)return tw(t).length;e=(""+e).toLowerCase(),r=!0}}function Tv(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Wv(this,e,n);case"utf8":case"utf-8":return Rv(this,e,n);case"ascii":return Qv(this,e,n);case"latin1":case"binary":return Yv(this,e,n);case"base64":return Bv(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fv(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function Lv(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Sv(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=bv.from(e,r)),xv(e))return 0===e.length?-1:jv(t,e,n,r,i);if("number"==typeof e)return e&=255,bv.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):jv(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function jv(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function Bv(t,e,n){return 0===e&&n===t.length?fv(t):fv(t.slice(e,n))}function Rv(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(t){var e=t.length;if(e<=Uv)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},bv.prototype.compare=function(t,e,n,r,i){if(!xv(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(r,i),c=t.slice(e,n),l=0;li)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return Cv(this,t,e,n);case"utf8":case"utf-8":return Dv(this,t,e,n);case"ascii":return Ov(this,t,e,n);case"latin1":case"binary":return zv(this,t,e,n);case"base64":return Pv(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _v(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},bv.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Uv=4096;function Qv(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;ir)&&(n=r);for(var i="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function Hv(t,e,n,r,i,o){if(!xv(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function Gv(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i>>8*(r?i:1-i)}function qv(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i>>8*(r?i:3-i)&255}function Zv(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Jv(t,e,n,r,i){return i||Zv(t,0,n,4),yv(t,e,n,r,23,4),n+4}function Xv(t,e,n,r,i){return i||Zv(t,0,n,8),yv(t,e,n,r,52,8),n+8}bv.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),e0&&(i*=256);)r+=this[t+--e]*i;return r},bv.prototype.readUInt8=function(t,e){return e||Vv(t,1,this.length),this[t]},bv.prototype.readUInt16LE=function(t,e){return e||Vv(t,2,this.length),this[t]|this[t+1]<<8},bv.prototype.readUInt16BE=function(t,e){return e||Vv(t,2,this.length),this[t]<<8|this[t+1]},bv.prototype.readUInt32LE=function(t,e){return e||Vv(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},bv.prototype.readUInt32BE=function(t,e){return e||Vv(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},bv.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||Vv(t,e,this.length);for(var r=this[t],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*e)),r},bv.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||Vv(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},bv.prototype.readInt8=function(t,e){return e||Vv(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},bv.prototype.readInt16LE=function(t,e){e||Vv(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},bv.prototype.readInt16BE=function(t,e){e||Vv(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},bv.prototype.readInt32LE=function(t,e){return e||Vv(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},bv.prototype.readInt32BE=function(t,e){return e||Vv(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},bv.prototype.readFloatLE=function(t,e){return e||Vv(t,4,this.length),pv(this,t,!0,23,4)},bv.prototype.readFloatBE=function(t,e){return e||Vv(t,4,this.length),pv(this,t,!1,23,4)},bv.prototype.readDoubleLE=function(t,e){return e||Vv(t,8,this.length),pv(this,t,!0,52,8)},bv.prototype.readDoubleBE=function(t,e){return e||Vv(t,8,this.length),pv(this,t,!1,52,8)},bv.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||Hv(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+n},bv.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,1,255,0),bv.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},bv.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,2,65535,0),bv.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):Gv(this,t,e,!0),e+2},bv.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,2,65535,0),bv.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):Gv(this,t,e,!1),e+2},bv.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,4,4294967295,0),bv.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):qv(this,t,e,!0),e+4},bv.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,4,4294967295,0),bv.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):qv(this,t,e,!1),e+4},bv.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Hv(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+n},bv.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Hv(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},bv.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,1,127,-128),bv.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},bv.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,2,32767,-32768),bv.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):Gv(this,t,e,!0),e+2},bv.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,2,32767,-32768),bv.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):Gv(this,t,e,!1),e+2},bv.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,4,2147483647,-2147483648),bv.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):qv(this,t,e,!0),e+4},bv.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||Hv(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),bv.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):qv(this,t,e,!1),e+4},bv.prototype.writeFloatLE=function(t,e,n){return Jv(this,t,e,!0,n)},bv.prototype.writeFloatBE=function(t,e,n){return Jv(this,t,e,!1,n)},bv.prototype.writeDoubleLE=function(t,e,n){return Xv(this,t,e,!0,n)},bv.prototype.writeDoubleBE=function(t,e,n){return Xv(this,t,e,!1,n)},bv.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=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=0;--i)t[i+e]=this[i+n];else if(o<1e3||!bv.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.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;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function ew(t){return function(t){var e,n,r,i,o,a;lv||hv();var s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new cv(3*s/4-o),r=o>0?s-4:s;var u=0;for(e=0,n=0;e>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=uv[t.charCodeAt(e)]<<2|uv[t.charCodeAt(e+1)]>>4,a[u++]=255&i):1===o&&(i=uv[t.charCodeAt(e)]<<10|uv[t.charCodeAt(e+1)]<<4|uv[t.charCodeAt(e+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Kv,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function nw(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function rw(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var iw=function(t){return t instanceof bv},ow=rp((function(t,e){var n=/%[sdj%]/g;e.format=function(t){if(!y(t)){for(var e=[],r=0;r=a)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(n)?r.showHidden=n:n&&e._extend(r,n),m(r.showHidden)&&(r.showHidden=!1),m(r.depth)&&(r.depth=2),m(r.colors)&&(r.colors=!1),m(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),u(r,t,r.depth)}function a(t,e){var n=o.styles[e];return n?"["+o.colors[n][0]+"m"+t+"["+o.colors[n][1]+"m":t}function s(t,e){return t}function u(t,n,r){if(t.customInspect&&n&&M(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,t);return y(i)||(i=u(t,i,r)),i}var o=function(t,e){if(m(e))return t.stylize("undefined","undefined");if(y(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}if(p(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(f(e))return t.stylize("null","null")}(t,n);if(o)return o;var a=Object.keys(n),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(n)),0===a.length){if(M(n)){var v=n.name?": "+n.name:"";return t.stylize("[Function"+v+"]","special")}if(g(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(w(n))return t.stylize(Date.prototype.toString.call(n),"date");if(b(n))return c(n)}var A,N="",I=!1,E=["{","}"];(h(n)&&(I=!0,E=["[","]"]),M(n))&&(N=" [Function"+(n.name?": "+n.name:"")+"]");return g(n)&&(N=" "+RegExp.prototype.toString.call(n)),w(n)&&(N=" "+Date.prototype.toUTCString.call(n)),b(n)&&(N=" "+c(n)),0!==a.length||I&&0!=n.length?r<0?g(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special"):(t.seen.push(n),A=I?function(t,e,n,r,i){for(var o=[],a=0,s=e.length;a60)return n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1];return n[0]+e+" "+t.join(", ")+" "+n[1]}(A,N,E)):E[0]+N+E[1]}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function l(t,e,n,r,i,o){var a,s,c;if((c=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(s=t.stylize("[Setter]","special")),x(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(c.value)<0?(s=f(n)?u(t,c.value,null):u(t,c.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),m(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function h(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function f(t){return null===t}function p(t){return"number"==typeof t}function y(t){return"string"==typeof t}function m(t){return void 0===t}function g(t){return v(t)&&"[object RegExp]"===A(t)}function v(t){return"object"==typeof t&&null!==t}function w(t){return v(t)&&"[object Date]"===A(t)}function b(t){return v(t)&&("[object Error]"===A(t)||t instanceof Error)}function M(t){return"function"==typeof t}function A(t){return Object.prototype.toString.call(t)}function N(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(m(r)&&(r=k.env.NODE_DEBUG||""),t=t.toUpperCase(),!i[t])if(new RegExp("\\b"+t+"\\b","i").test(r)){var n=k.pid;i[t]=function(){var r=e.format.apply(e,arguments);console.error("%s %d: %s",t,n,r)}}else i[t]=function(){};return i[t]},e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=h,e.isBoolean=d,e.isNull=f,e.isNullOrUndefined=function(t){return null==t},e.isNumber=p,e.isString=y,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=m,e.isRegExp=g,e.isObject=v,e.isDate=w,e.isError=b,e.isFunction=M,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=iw;var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function E(){var t=new Date,e=[N(t.getHours()),N(t.getMinutes()),N(t.getSeconds())].join(":");return[t.getDate(),I[t.getMonth()],e].join(" ")}function x(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",E(),e.format.apply(e,arguments))},e.inherits=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})},e._extend=function(t,e){if(!e||!v(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}})),aw=rp((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}}));function sw(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function uw(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function cw(t){return 1===t.length?"0"+t:t}function lw(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}var hw={inherits:rp((function(t){try{var e=ow;if("function"!=typeof e.inherits)throw"";t.exports=e.inherits}catch(e){t.exports=aw}})),toArray:function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,n[r++]=63&o|128):sw(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i>>0}return o},split32:function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},rotr32:function(t,e){return t>>>e|t<<32-e},rotl32:function(t,e){return t<>>32-e},sum32:function(t,e){return t+e>>>0},sum32_3:function(t,e,n){return t+e+n>>>0},sum32_4:function(t,e,n,r){return t+e+n+r>>>0},sum32_5:function(t,e,n,r,i){return t+e+n+r+i>>>0},sum64:function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o>>0,t[e+1]=o},sum64_hi:function(t,e,n,r){return(e+r>>>0>>0},sum64_lo:function(t,e,n,r){return e+r>>>0},sum64_4_hi:function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)>>0)>>0)>>0},sum64_4_lo:function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},sum64_5_hi:function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)>>0)>>0)>>0)>>0},sum64_5_lo:function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},rotr64_hi:function(t,e,n){return(e<<32-n|t>>>n)>>>0},rotr64_lo:function(t,e,n){return(t<<32-n|e>>>n)>>>0},shr64_hi:function(t,e,n){return t>>>n},shr64_lo:function(t,e,n){return(t<<32-n|e>>>n)>>>0}};function dw(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var fw=dw;dw.prototype.update=function(t,e){if(t=hw.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=hw.join32(t,0,t.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},g1_256:function(t){return yw(t,17)^yw(t,19)^t>>>10}},bw=hw.rotl32,Mw=hw.sum32,Aw=hw.sum32_5,Nw=ww.ft_1,Iw=pw.BlockHash,Ew=[1518500249,1859775393,2400959708,3395469782];function xw(){if(!(this instanceof xw))return new xw;Iw.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}hw.inherits(xw,Iw);var kw=xw;xw.blockSize=512,xw.outSize=160,xw.hmacStrength=80,xw.padLength=64,xw.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;rthis.blockSize&&(t=(new this.Hash).update(t).digest()),ov(t.length<=this.blockSize);for(var e=t.length;e>8,a=255&i;o?n.push(o,a):n.push(a)}return n},n.zero2=r,n.toHex=i,n.encode=function(t,e){return"hex"===e?i(t):t}})),Qb=_b((function(t,e){var n=e;n.assert=Bb,n.toArray=Ub.toArray,n.zero2=Ub.zero2,n.toHex=Ub.toHex,n.encode=Ub.encode,n.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},n.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0==(1&c)?0:3!==(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},n.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new iv(t,"hex","le")}})),Yb=Qb.getNAF,Wb=Qb.getJSF,Fb=Qb.assert;function Vb(t,e){this.type=t,this.p=new iv(e.p,16),this.red=e.prime?iv.red(e.prime):iv.mont(this.p),this.zero=new iv(0).toRed(this.red),this.one=new iv(1).toRed(this.red),this.two=new iv(2).toRed(this.red),this.n=e.n&&new iv(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hb=Vb;function Gb(t,e){this.curve=t,this.type=e,this.precomputed=null}Vb.prototype.point=function(){throw new Error("Not implemented")},Vb.prototype.validate=function(){throw new Error("Not implemented")},Vb.prototype._fixedNafMul=function(t,e){Fb(t.precomputed);var n=t._getDoubles(),r=Yb(e,1,this._bitLength),i=(1<=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];Fb(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},Vb.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var y=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(y[1]=e[f].add(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].add(e[p].neg())):(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=Wb(n[f],n[p]);for(h=Math.max(g[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a=0;o--){for(var A=0;o>=0;){var N=!0;for(a=0;a=0&&A++,b=b.dblp(A),o<0)break;for(a=0;a0?s=c[a][I-1>>1]:I<0&&(s=c[a][-I-1>>1].neg()),b="affine"===s.type?b.mixedAdd(s):b.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},Gb.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},Jb.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},Jb.prototype.pointFromX=function(t,e){(t=new iv(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},Jb.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Jb.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},Kb.prototype.isInfinity=function(){return this.inf},Kb.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},Kb.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Kb.prototype.getX=function(){return this.x.fromRed()},Kb.prototype.getY=function(){return this.y.fromRed()},Kb.prototype.mul=function(t){return t=new iv(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Kb.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},Kb.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},Kb.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Kb.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},Kb.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},qb($b,Hb.BasePoint),Jb.prototype.jpoint=function(t,e,n){return new $b(this,t,e,n)},$b.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},$b.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$b.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},$b.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},$b.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},$b.prototype.inspect=function(){return this.isInfinity()?"":""},$b.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var tM=_b((function(t,e){var n=e;n.base=Hb,n.short=Xb,n.mont=null,n.edwards=null})),eM=_b((function(t,e){var n,r=e,i=Qb.assert;function o(t){"short"===t.type?this.curve=new tM.short(t):"edwards"===t.type?this.curve=new tM.edwards(t):this.curve=new tM.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new o(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Pb.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Pb.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Pb.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Pb.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Pb.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Pb.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Pb.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(t){n=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Pb.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function nM(t){if(!(this instanceof nM))return new nM(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Ub.toArray(t.entropy,t.entropyEnc||"hex"),n=Ub.toArray(t.nonce,t.nonceEnc||"hex"),r=Ub.toArray(t.pers,t.persEnc||"hex");Bb(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var rM=nM;nM.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},nM.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=Ub.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var sM=Qb.assert;function uM(t,e){if(t instanceof uM)return t;this._importDER(t,e)||(sM(t.r&&t.s,"Signature without r or s"),this.r=new iv(t.r,16),this.s=new iv(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var cM=uM;function lM(){this.place=0}function hM(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o>>=0;return!(i<=127)&&(e.place=a,i)}function dM(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}uM.prototype._importDER=function(t,e){t=Qb.toArray(t,e);var n=new lM;if(48!==t[n.place++])return!1;var r=hM(t,n);if(!1===r)return!1;if(r+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var i=hM(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=hM(t,n);if(!1===a)return!1;if(t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new iv(o),this.s=new iv(s),this.recoveryParam=null,!0},uM.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=dM(e),n=dM(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];fM(r,e.length),(r=r.concat(e)).push(2),fM(r,n.length);var i=r.concat(n),o=[48];return fM(o,i.length),o=o.concat(i),Qb.encode(o,t)};var pM=function(){throw new Error("unsupported")},yM=Qb.assert;function mM(t){if(!(this instanceof mM))return new mM(t);"string"==typeof t&&(yM(Object.prototype.hasOwnProperty.call(eM,t),"Unknown curve "+t),t=eM[t]),t instanceof eM.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var gM=mM;mM.prototype.keyPair=function(t){return new aM(this,t)},mM.prototype.keyFromPrivate=function(t,e){return aM.fromPrivate(this,t,e)},mM.prototype.keyFromPublic=function(t,e){return aM.fromPublic(this,t,e)},mM.prototype.genKeyPair=function(t){t||(t={});for(var e=new rM({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||pM(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new iv(2));;){var i=new iv(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},mM.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},mM.prototype.sign=function(t,e,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new iv(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new rM({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new iv(1)),c=0;;c++){var l=r.k?r.k(c):new iv(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new cM({r:f,s:p,recoveryParam:y})}}}}}},mM.prototype.verify=function(t,e,n,r){t=this._truncateToN(new iv(t,16)),n=this.keyFromPublic(n,r);var i=(e=new cM(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},mM.prototype.recoverPubKey=function(t,e,n,r){yM((3&n)===n,"The recovery param is more than two bits"),e=new cM(e,r);var i=this.n,o=new iv(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},mM.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new cM(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var vM=_b((function(t,e){var n=e;n.version="6.5.4",n.utils=Qb,n.rand=function(){throw new Error("unsupported")},n.curve=tM,n.curves=eM,n.ec=gM,n.eddsa=null})).ec;const wM=new Lp("signing-key/5.7.0");let bM=null;function MM(){return bM||(bM=new vM("secp256k1")),bM}class AM{constructor(t){My(this,"curve","secp256k1"),My(this,"privateKey",Yp(t)),32!==Wp(this.privateKey)&&wM.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=MM().keyFromPrivate(Pp(this.privateKey));My(this,"publicKey","0x"+e.getPublic(!1,"hex")),My(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),My(this,"_isSigningKey",!0)}_addPoint(t){const e=MM().keyFromPublic(Pp(this.publicKey)),n=MM().keyFromPublic(Pp(t));return"0x"+e.pub.add(n.pub).encodeCompressed("hex")}signDigest(t){const e=MM().keyFromPrivate(Pp(this.privateKey)),n=Pp(t);32!==n.length&&wM.throwArgumentError("bad digest length","digest",t);const r=e.sign(n,{canonical:!0});return qp({recoveryParam:r.recoveryParam,r:Gp("0x"+r.r.toString(16),32),s:Gp("0x"+r.s.toString(16),32)})}computeSharedSecret(t){const e=MM().keyFromPrivate(Pp(this.privateKey)),n=MM().keyFromPublic(Pp(NM(t)));return Gp("0x"+e.derive(n.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function NM(t,e){const n=Pp(t);if(32===n.length){const t=new AM(n);return e?"0x"+MM().keyFromPrivate(n).getPublic(!0,"hex"):t.publicKey}return 33===n.length?e?Yp(n):"0x"+MM().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?e?"0x"+MM().keyFromPublic(n).getPublic(!0,"hex"):Yp(n):wM.throwArgumentError("invalid public or private key","key","[REDACTED]")}const IM=new Lp("transactions/5.7.0");var EM;function xM(t){return"0x"===t?null:vm(t)}function kM(t){return"0x"===t?Cm:ey.from(t)}function TM(t,e){return function(t){return vm(Fp(om(Fp(NM(t),1)),12))}(function(t,e){const n=qp(e),r={r:Pp(n.r),s:Pp(n.s)};return"0x"+MM().recoverPubKey(Pp(t),r,n.recoveryParam).encode("hex",!1)}(Pp(t),e))}function LM(t,e){const n=Bp(ey.from(t).toHexString());return n.length>32&&IM.throwArgumentError("invalid length for "+e,"transaction:"+e,t),n}function SM(t,e){return{address:vm(t),storageKeys:(e||[]).map(((e,n)=>(32!==Wp(e)&&IM.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,e),e.toLowerCase())))}}function jM(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&IM.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),SM(t[0],t[1])):SM(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const n=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return SM(e,Object.keys(n).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function CM(t){return jM(t).map((t=>[t.address,t.storageKeys]))}function DM(t,e){if(null!=t.gasPrice){const e=ey.from(t.gasPrice),n=ey.from(t.maxFeePerGas||0);e.eq(n)||IM.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:n})}const n=[LM(t.chainId||0,"chainId"),LM(t.nonce||0,"nonce"),LM(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),LM(t.maxFeePerGas||0,"maxFeePerGas"),LM(t.gasLimit||0,"gasLimit"),null!=t.to?vm(t.to):"0x",LM(t.value||0,"value"),t.data||"0x",CM(t.accessList||[])];if(e){const t=qp(e);n.push(LM(t.recoveryParam,"recoveryParam")),n.push(Bp(t.r)),n.push(Bp(t.s))}return Vp(["0x02",lm(n)])}function OM(t,e){const n=[LM(t.chainId||0,"chainId"),LM(t.nonce||0,"nonce"),LM(t.gasPrice||0,"gasPrice"),LM(t.gasLimit||0,"gasLimit"),null!=t.to?vm(t.to):"0x",LM(t.value||0,"value"),t.data||"0x",CM(t.accessList||[])];if(e){const t=qp(e);n.push(LM(t.recoveryParam,"recoveryParam")),n.push(Bp(t.r)),n.push(Bp(t.s))}return Vp(["0x01",lm(n)])}function zM(t,e,n){try{const n=kM(e[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");t.v=n}catch(t){IM.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=Gp(e[1],32),t.s=Gp(e[2],32);try{const e=om(n(t));t.from=TM(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){}}function PM(t){const e=Pp(t);if(e[0]>127)return function(t){const e=fm(t);9!==e.length&&6!==e.length&&IM.throwArgumentError("invalid raw transaction","rawTransaction",t);const n={nonce:kM(e[0]).toNumber(),gasPrice:kM(e[1]),gasLimit:kM(e[2]),to:xM(e[3]),value:kM(e[4]),data:e[5],chainId:0};if(6===e.length)return n;try{n.v=ey.from(e[6]).toNumber()}catch(t){return n}if(n.r=Gp(e[7],32),n.s=Gp(e[8],32),ey.from(n.r).isZero()&&ey.from(n.s).isZero())n.chainId=n.v,n.v=0;else{n.chainId=Math.floor((n.v-35)/2),n.chainId<0&&(n.chainId=0);let r=n.v-27;const i=e.slice(0,6);0!==n.chainId&&(i.push(Yp(n.chainId)),i.push("0x"),i.push("0x"),r-=2*n.chainId+8);const o=om(lm(i));try{n.from=TM(o,{r:Yp(n.r),s:Yp(n.s),recoveryParam:r})}catch(t){}n.hash=om(t)}return n.type=null,n}(e);switch(e[0]){case 1:return function(t){const e=fm(t.slice(1));8!==e.length&&11!==e.length&&IM.throwArgumentError("invalid component count for transaction type: 1","payload",Yp(t));const n={type:1,chainId:kM(e[0]).toNumber(),nonce:kM(e[1]).toNumber(),gasPrice:kM(e[2]),gasLimit:kM(e[3]),to:xM(e[4]),value:kM(e[5]),data:e[6],accessList:jM(e[7])};return 8===e.length||(n.hash=om(t),zM(n,e.slice(8),OM)),n}(e);case 2:return function(t){const e=fm(t.slice(1));9!==e.length&&12!==e.length&&IM.throwArgumentError("invalid component count for transaction type: 2","payload",Yp(t));const n=kM(e[2]),r=kM(e[3]),i={type:2,chainId:kM(e[0]).toNumber(),nonce:kM(e[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:kM(e[4]),to:xM(e[5]),value:kM(e[6]),data:e[7],accessList:jM(e[8])};return 9===e.length||(i.hash=om(t),zM(i,e.slice(9),DM)),i}(e)}return IM.throwError(`unsupported transaction type: ${e[0]}`,Lp.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(EM||(EM={}));var _M=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const BM=new Lp("contracts/5.7.0");function RM(t,e){return _M(this,void 0,void 0,(function*(){const n=yield e;"string"!=typeof n&&BM.throwArgumentError("invalid address or ENS name","name",n);try{return vm(n)}catch(t){}t||BM.throwError("a provider or signer is needed to resolve ENS names",Lp.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield t.resolveName(n);return null==r&&BM.throwArgumentError("resolver or addr is not configured for ENS name","name",n),r}))}function UM(t,e,n){return _M(this,void 0,void 0,(function*(){return Array.isArray(n)?yield Promise.all(n.map(((n,r)=>UM(t,Array.isArray(e)?e[r]:e[n.name],n)))):"address"===n.type?yield RM(t,e):"tuple"===n.type?yield UM(t,e,n.components):"array"===n.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>UM(t,e,n.arrayChildren)))):Promise.reject(BM.makeError("invalid value for array",Lp.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function QM(t,e,n){return _M(this,void 0,void 0,(function*(){let r={};n.length===e.inputs.length+1&&"object"==typeof n[n.length-1]&&(r=Iy(n.pop())),BM.checkArgumentCount(n.length,e.inputs.length,"passed to contract"),t.signer?r.from?r.from=Ny({override:RM(t.signer,r.from),signer:t.signer.getAddress()}).then((t=>_M(this,void 0,void 0,(function*(){return vm(t.signer)!==t.override&&BM.throwError("Contract with a Signer cannot override from",Lp.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):r.from=t.signer.getAddress():r.from&&(r.from=RM(t.provider,r.from));const i=yield Ny({args:UM(t.signer||t.provider,n,e.inputs),address:t.resolvedAddress,overrides:Ny(r)||{}}),o=t.interface.encodeFunctionData(e,i.args),a={data:o,to:i.address},s=i.overrides;if(null!=s.nonce&&(a.nonce=ey.from(s.nonce).toNumber()),null!=s.gasLimit&&(a.gasLimit=ey.from(s.gasLimit)),null!=s.gasPrice&&(a.gasPrice=ey.from(s.gasPrice)),null!=s.maxFeePerGas&&(a.maxFeePerGas=ey.from(s.maxFeePerGas)),null!=s.maxPriorityFeePerGas&&(a.maxPriorityFeePerGas=ey.from(s.maxPriorityFeePerGas)),null!=s.from&&(a.from=s.from),null!=s.type&&(a.type=s.type),null!=s.accessList&&(a.accessList=jM(s.accessList)),null==a.gasLimit&&null!=e.gas){let t=21e3;const n=Pp(o);for(let e=0;enull!=r[t]));return u.length&&BM.throwError(`cannot override ${u.map((t=>JSON.stringify(t))).join(",")}`,Lp.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),a}))}function YM(t,e,n){const r=t.signer||t.provider;return function(...i){return _M(this,void 0,void 0,(function*(){let o;if(i.length===e.inputs.length+1&&"object"==typeof i[i.length-1]){const t=Iy(i.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,i.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const a=yield QM(t,e,i),s=yield r.call(a,o);try{let r=t.interface.decodeFunctionResult(e,s);return n&&1===e.outputs.length&&(r=r[0]),r}catch(e){throw e.code===Lp.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=i,e.transaction=a),e}}))}}function WM(t,e){return function(...n){return _M(this,void 0,void 0,(function*(){t.signer||BM.throwError("sending a transaction requires a signer",Lp.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const r=yield QM(t,e,n),i=yield t.signer.sendTransaction(r);return function(t,e){const n=e.wait.bind(e);e.wait=e=>n(e).then((e=>(e.events=e.logs.map((n=>{let r=Ty(n),i=null;try{i=t.interface.parseLog(n)}catch(t){}return i&&(r.args=i.args,r.decode=(e,n)=>t.interface.decodeEventLog(i.eventFragment,e,n),r.event=i.name,r.eventSignature=i.signature),r.removeListener=()=>t.provider,r.getBlock=()=>t.provider.getBlock(e.blockHash),r.getTransaction=()=>t.provider.getTransaction(e.transactionHash),r.getTransactionReceipt=()=>Promise.resolve(e),r})),e)))}(t,i),i}))}}function FM(t,e,n){return e.constant?YM(t,e,n):WM(t,e)}function VM(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class HM{constructor(t,e){My(this,"tag",t),My(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((n=>!(!e&&n.listener===t)||(e=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const n=t.slice();return setTimeout((()=>{e.listener.apply(this,n)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class GM extends HM{constructor(){super("error",null)}}class qM extends HM{constructor(t,e,n,r){const i={address:t};let o=e.getEventTopic(n);r?(o!==r[0]&&BM.throwArgumentError("topic mismatch","topics",r),i.topics=r.slice()):i.topics=[o],super(VM(i),i),My(this,"address",t),My(this,"interface",e),My(this,"fragment",n)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=function(t){const e=[],n=function(t,r){if(Array.isArray(r))for(let i in r){const o=t.slice();o.push(i);try{n(o,r[i])}catch(t){e.push({path:o,error:t})}}};return n([],t),e}(t.args);if(e.length)throw e[0].error;const n=(t.args||[]).slice();return n.push(t),n}}class ZM extends HM{constructor(t,e){super("*",{address:t}),My(this,"address",t),My(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,n)=>this.interface.decodeEventLog(e.eventFragment,t,n),t.args=e.args}catch(t){}}}class JM extends class{constructor(t,e,n){My(this,"interface",Ay(new.target,"getInterface")(e)),null==n?(My(this,"provider",null),My(this,"signer",null)):nv.isSigner(n)?(My(this,"provider",n.provider||null),My(this,"signer",n)):Xg.isProvider(n)?(My(this,"provider",n),My(this,"signer",null)):BM.throwArgumentError("invalid signer or provider","signerOrProvider",n),My(this,"callStatic",{}),My(this,"estimateGas",{}),My(this,"functions",{}),My(this,"populateTransaction",{}),My(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const n=this.interface.events[e];My(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(n,t)}))),t[n.name]||(t[n.name]=[]),t[n.name].push(e)})),Object.keys(t).forEach((e=>{const n=t[e];1===n.length?My(this.filters,e,this.filters[n[0]]):BM.warn(`Duplicate definition of ${e} (${n.join(", ")})`)}))}if(My(this,"_runningEvents",{}),My(this,"_wrappedEmits",{}),null==t&&BM.throwArgumentError("invalid contract address or ENS name","addressOrName",t),My(this,"address",t),this.provider)My(this,"resolvedAddress",RM(this.provider,t));else try{My(this,"resolvedAddress",Promise.resolve(vm(t)))}catch(t){BM.throwError("provider is required to use ENS name as contract address",Lp.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((t=>{}));const r={},i={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(i[t])BM.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{i[t]=!0;{const n=e.name;r[`%${n}`]||(r[`%${n}`]=[]),r[`%${n}`].push(t)}null==this[t]&&My(this,t,FM(this,e,!0)),null==this.functions[t]&&My(this.functions,t,FM(this,e,!1)),null==this.callStatic[t]&&My(this.callStatic,t,YM(this,e,!0)),null==this.populateTransaction[t]&&My(this.populateTransaction,t,function(t,e){return function(...n){return QM(t,e,n)}}(this,e)),null==this.estimateGas[t]&&My(this.estimateGas,t,function(t,e){const n=t.signer||t.provider;return function(...r){return _M(this,void 0,void 0,(function*(){n||BM.throwError("estimate require a provider or signer",Lp.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield QM(t,e,r);return yield n.estimateGas(i)}))}}(this,e))}})),Object.keys(r).forEach((t=>{const e=r[t];if(e.length>1)return;t=t.substring(1);const n=e[0];try{null==this[t]&&My(this,t,this[n])}catch(t){}null==this.functions[t]&&My(this.functions,t,this.functions[n]),null==this.callStatic[t]&&My(this.callStatic,t,this.callStatic[n]),null==this.populateTransaction[t]&&My(this.populateTransaction,t,this.populateTransaction[n]),null==this.estimateGas[t]&&My(this.estimateGas,t,this.estimateGas[n])}))}static getContractAddress(t){return wm(t)}static getInterface(t){return Gg.isInterface(t)?t:new Gg(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,t).then((t=>("0x"===t&&BM.throwError("contract not deployed",Lp.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||BM.throwError("sending a transactions require a signer",Lp.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=Iy(t||{});return["from","to"].forEach((function(t){null!=e[t]&&BM.throwError("cannot override "+t,Lp.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new rv(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&My(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return Fg.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new GM);if("event"===t)return this._normalizeRunningEvent(new HM("event",null));if("*"===t)return this._normalizeRunningEvent(new ZM(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new qM(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const n=this.interface.getEvent(e);return this._normalizeRunningEvent(new qM(this.address,this.interface,n,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new HM(VM(e),e))}return this._normalizeRunningEvent(new ZM(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,n){const r=Ty(e);return r.removeListener=()=>{n&&(t.removeListener(n),this._checkRunningEvents(t))},r.getBlock=()=>this.provider.getBlock(e.blockHash),r.getTransaction=()=>this.provider.getTransaction(e.transactionHash),r.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(r),r}_addEventListener(t,e,n){if(this.provider||BM.throwError("events require a provider or a signer with a provider",Lp.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,n),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const n=n=>{let r=this._wrapEvent(t,n,e);if(null==r.decodeError)try{const e=t.getEmit(r);this.emit(t.filter,...e)}catch(t){r.decodeError=t.error}null!=t.filter&&this.emit("event",r),null!=r.decodeError&&this.emit("error",r.decodeError,r)};this._wrappedEmits[t.tag]=n,null!=t.filter&&this.provider.on(t.filter,n)}}queryFilter(t,e,n){const r=this._getRunningEvent(t),i=Iy(r.filter);return"string"==typeof e&&Up(e,32)?(null!=n&&BM.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),i.blockHash=e):(i.fromBlock=null!=e?e:0,i.toBlock=null!=n?n:"latest"),this.provider.getLogs(i).then((t=>t.map((t=>this._wrapEvent(r,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const n=this._getRunningEvent(t),r=n.run(e)>0;return this._checkRunningEvents(n),r}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const n=this._getRunningEvent(t);return n.removeListener(e),this._checkRunningEvents(n),this}removeListener(t,e){return this.off(t,e)}}{}class XM{constructor(t){My(this,"alphabet",t),My(this,"base",t.length),My(this,"_alphabetMap",{}),My(this,"_leader",t.charAt(0));for(let e=0;e0;)n.push(r%this.base),r=r/this.base|0}let r="";for(let t=0;0===e[t]&&t=0;--t)r+=this.alphabet[n[t]];return r}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let n=0;n>=8;for(;i>0;)e.push(255&i),i>>=8}for(let n=0;t[n]===this._leader&&n{o[e.toLowerCase()]=t})):r.headers.keys().forEach((t=>{o[t.toLowerCase()]=r.headers.get(t)})),{headers:o,statusCode:r.status,statusMessage:r.statusText,body:Pp(new Uint8Array(i))}}))}var cA=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const lA=new Lp("web/5.7.1");function hA(t){return new Promise((e=>{setTimeout(e,t)}))}function dA(t,e){if(null==t)return null;if("string"==typeof t)return t;if(Dp(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return Wm(t)}catch(t){}return Yp(t)}return t}function fA(t,e,n){let r=null;if(null!=e){r=Ym(e);const n="string"==typeof t?{url:t}:Iy(t);if(n.headers){0!==Object.keys(n.headers).filter((t=>"content-type"===t.toLowerCase())).length||(n.headers=Iy(n.headers),n.headers["content-type"]="application/json")}else n.headers={"content-type":"application/json"};t=n}return function(t,e,n){const r="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;lA.assertArgument(r>0&&r%1==0,"invalid connection throttle limit","connection.throttleLimit",r);const i="object"==typeof t?t.throttleCallback:null,o="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;lA.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const a="object"==typeof t&&!!t.errorPassThrough,s={};let u=null;const c={method:"GET"};let l=!1,h=12e4;if("string"==typeof t)u=t;else if("object"==typeof t){if(null!=t&&null!=t.url||lA.throwArgumentError("missing URL","connection.url",t),u=t.url,"number"==typeof t.timeout&&t.timeout>0&&(h=t.timeout),t.headers)for(const e in t.headers)s[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(l=!0);if(c.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==u.substring(0,6)&&!0!==t.allowInsecureAuthentication&&lA.throwError("basic authentication requires a secure https url",Lp.errors.INVALID_ARGUMENT,{argument:"url",url:u,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;s.authorization={key:"Authorization",value:"Basic "+$m(Ym(e))}}null!=t.skipFetchSetup&&(c.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(c.fetchOptions=Iy(t.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),f=u?u.match(d):null;if(f)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]||"text/plain"},body:f[2]?Km(f[3]):(p=f[3],Ym(p.replace(/%([0-9a-f][0-9a-f])/gi,((t,e)=>String.fromCharCode(parseInt(e,16))))))};let e=t.body;return n&&(e=n(t.body,t)),Promise.resolve(e)}catch(t){lA.throwError("processing response error",Lp.errors.SERVER_ERROR,{body:dA(f[1],f[2]),error:t,requestBody:null,requestMethod:"GET",url:u})}var p;e&&(c.method="POST",c.body=e,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(e.length)}));const y={};Object.keys(s).forEach((t=>{const e=s[t];y[e.key]=e.value})),c.headers=y;const m=function(){let t=null;return{promise:new Promise((function(e,n){h&&(t=setTimeout((()=>{null!=t&&(t=null,n(lA.makeError("timeout",Lp.errors.TIMEOUT,{requestBody:dA(c.body,y["content-type"]),requestMethod:c.method,timeout:h,url:u})))}),h))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),g=function(){return cA(this,void 0,void 0,(function*(){for(let t=0;t=300)&&(m.cancel(),lA.throwError("bad response",Lp.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:dA(s,e.headers?e.headers["content-type"]:null),requestBody:dA(c.body,y["content-type"]),requestMethod:c.method,url:u})),n)try{const t=yield n(s,e);return m.cancel(),t}catch(n){if(n.throttleRetry&&t{let r=null;if(null!=t)try{r=JSON.parse(Wm(t))}catch(e){lA.throwError("invalid JSON",Lp.errors.SERVER_ERROR,{body:t,error:e})}return n&&(r=n(r,e)),r}))}function pA(t,e){return e||(e={}),null==(e=Iy(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(n,r){let i=null,o=!1;const a=()=>!o&&(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout((()=>{a()&&r(new Error("timeout"))}),e.timeout));const s=e.retryLimit;let u=0;!function i(){return t().then((function(t){if(void 0!==t)a()&&n(t);else if(e.oncePoll)e.oncePoll.once("poll",i);else if(e.onceBlock)e.onceBlock.once("block",i);else if(!o){if(u++,u>s)return void(a()&&r(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,u)));te.ceiling&&(t=e.ceiling),setTimeout(i,t)}return null}),(function(t){a()&&r(t)}))}()}))}for(var yA="qpzry9x8gf2tvdw0s3jn54khce6mua7l",mA={},gA=0;gA>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function bA(t){for(var e=1,n=0;n126)return"Invalid prefix ("+t+")";e=wA(e)^r>>5}for(e=wA(e),n=0;ne)return"Exceeds length limit";var n=t.toLowerCase(),r=t.toUpperCase();if(t!==n&&t!==r)return"Mixed-case string "+t;var i=(t=n).lastIndexOf("1");if(-1===i)return"No separator character for "+t;if(0===i)return"Missing prefix for "+t;var o=t.slice(0,i),a=t.slice(i+1);if(a.length<6)return"Data too short";var s=bA(o);if("string"==typeof s)return s;for(var u=[],c=0;c=a.length||u.push(h)}return 1!==s?"Invalid checksum for "+t:{prefix:o,words:u}}function AA(t,e,n,r){for(var i=0,o=0,a=(1<=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<=e)return"Excess padding";if(i<n)throw new TypeError("Exceeds length limit");var r=bA(t=t.toLowerCase());if("string"==typeof r)throw new Error(r);for(var i=t+"1",o=0;o>5!=0)throw new Error("Non 5-bit word");r=wA(r)^a,i+=yA.charAt(a)}for(o=0;o<6;++o)r=wA(r);for(r^=1,o=0;o<6;++o){i+=yA.charAt(r>>5*(5-o)&31)}return i},toWordsUnsafe:function(t){var e=AA(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=AA(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=AA(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=AA(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}};const IA="providers/5.7.2",EA=new Lp(IA);class xA{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),n=this.bigNumber.bind(this),r=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),s=this.number.bind(this),u=this.type.bind(this);return t.transaction={hash:o,type:u,accessList:xA.allowNull(this.accessList.bind(this),null),blockHash:xA.allowNull(o,null),blockNumber:xA.allowNull(s,null),transactionIndex:xA.allowNull(s,null),confirmations:xA.allowNull(s,null),from:e,gasPrice:xA.allowNull(n),maxPriorityFeePerGas:xA.allowNull(n),maxFeePerGas:xA.allowNull(n),gasLimit:n,to:xA.allowNull(e,null),value:n,nonce:s,data:i,r:xA.allowNull(this.uint256),s:xA.allowNull(this.uint256),v:xA.allowNull(s),creates:xA.allowNull(e,null),raw:xA.allowNull(i)},t.transactionRequest={from:xA.allowNull(e),nonce:xA.allowNull(s),gasLimit:xA.allowNull(n),gasPrice:xA.allowNull(n),maxPriorityFeePerGas:xA.allowNull(n),maxFeePerGas:xA.allowNull(n),to:xA.allowNull(e),value:xA.allowNull(n),data:xA.allowNull((t=>this.data(t,!0))),type:xA.allowNull(s),accessList:xA.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:s,blockNumber:s,transactionHash:o,address:e,topics:xA.arrayOf(o),data:i,logIndex:s,blockHash:o},t.receipt={to:xA.allowNull(this.address,null),from:xA.allowNull(this.address,null),contractAddress:xA.allowNull(e,null),transactionIndex:s,root:xA.allowNull(a),gasUsed:n,logsBloom:xA.allowNull(i),blockHash:o,transactionHash:o,logs:xA.arrayOf(this.receiptLog.bind(this)),blockNumber:s,confirmations:xA.allowNull(s,null),cumulativeGasUsed:n,effectiveGasPrice:xA.allowNull(n),status:xA.allowNull(s),type:u},t.block={hash:xA.allowNull(o),parentHash:o,number:s,timestamp:s,nonce:xA.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:xA.allowNull(e),extraData:i,transactions:xA.allowNull(xA.arrayOf(o)),baseFeePerGas:xA.allowNull(n)},t.blockWithTransactions=Iy(t.block),t.blockWithTransactions.transactions=xA.allowNull(xA.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:xA.allowNull(r,void 0),toBlock:xA.allowNull(r,void 0),blockHash:xA.allowNull(o,void 0),address:xA.allowNull(e,void 0),topics:xA.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:xA.allowNull(s),blockHash:xA.allowNull(o),transactionIndex:s,removed:xA.allowNull(this.boolean.bind(this)),address:e,data:xA.allowFalsish(i,"0x"),topics:xA.arrayOf(o),transactionHash:o,logIndex:s},t}accessList(t){return jM(t||[])}number(t){return"0x"===t?0:ey.from(t).toNumber()}type(t){return"0x"===t||null==t?0:ey.from(t).toNumber()}bigNumber(t){return ey.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),Up(t))?t.toLowerCase():EA.throwArgumentError("invalid hash","value",t)}data(t,e){const n=this.hex(t,e);if(n.length%2!=0)throw new Error("invalid data; odd-length - "+t);return n}address(t){return vm(t)}callAddress(t){if(!Up(t,32))return null;const e=vm(Fp(t,12));return"0x0000000000000000000000000000000000000000"===e?null:e}contractAddress(t){return wm(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";switch(t){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return t}if("number"==typeof t||Up(t))return Hp(t);throw new Error("invalid blockTag")}hash(t,e){const n=this.hex(t,e);return 32!==Wp(n)?EA.throwArgumentError("invalid hash","value",t):n}difficulty(t){if(null==t)return null;const e=ey.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!Up(t))throw new Error("invalid uint256");return Gp(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);const n=null!=t._difficulty?t._difficulty:t.difficulty,r=xA.check(e,t);return r._difficulty=null==n?null:ey.from(n),r}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return xA.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&ey.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const e=xA.check(this.formats.transaction,t);if(null!=t.chainId){let n=t.chainId;Up(n)&&(n=ey.from(n).toNumber()),e.chainId=n}else{let n=t.networkId;null==n&&null==e.v&&(n=t.chainId),Up(n)&&(n=ey.from(n).toNumber()),"number"!=typeof n&&null!=e.v&&(n=(e.v-35)/2,n<0&&(n=0),n=parseInt(n)),"number"!=typeof n&&(n=0),e.chainId=n}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return PM(t)}receiptLog(t){return xA.check(this.formats.receiptLog,t)}receipt(t){const e=xA.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=ey.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&EA.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):EA.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&EA.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map((t=>this.topics(t))):null!=t?this.hash(t,!0):null}filter(t){return xA.check(this.formats.filter,t)}filterLog(t){return xA.check(this.formats.filterLog,t)}static check(t,e){const n={};for(const r in t)try{const i=t[r](e[r]);void 0!==i&&(n[r]=i)}catch(t){throw t.checkKey=r,t.checkValue=e[r],t}return n}static allowNull(t,e){return function(n){return null==n?e:t(n)}}static allowFalsish(t,e){return function(n){return n?t(n):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const n=[];return e.forEach((function(e){n.push(t(e))})),n}}}var kA=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const TA=new Lp(IA);function LA(t){return null==t?"null":(32!==Wp(t)&&TA.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function SA(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map((t=>{if(Array.isArray(t)){const e={};t.forEach((t=>{e[LA(t)]=!0}));const n=Object.keys(e);return n.sort(),n.join("|")}return LA(t)})).join("&")}function jA(t){if("string"==typeof t){if(32===Wp(t=t.toLowerCase()))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+SA(t);if(Jg.isForkEvent(t))throw TA.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+SA(t.topics||[])}throw new Error("invalid event - "+t)}function CA(){return(new Date).getTime()}function DA(t){return new Promise((e=>{setTimeout(e,t)}))}const OA=["block","network","pending","poll"];class zA{constructor(t,e,n){My(this,"tag",t),My(this,"listener",e),My(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],n=""===(r=t[2])?[]:r.split(/&/g).map((t=>{if(""===t)return[];const e=t.split("|").map((t=>"null"===t?null:t));return 1===e.length?e[0]:e}));var r;const i={};return n.length>0&&(i.topics=n),e&&"*"!==e&&(i.address=e),i}pollable(){return this.tag.indexOf(":")>=0||OA.indexOf(this.tag)>=0}}const PA={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function _A(t){return Gp(ey.from(t).toHexString(),32)}function BA(t){return KM.encode(_p([t,Fp($M($M(t)),0,4)]))}const RA=new RegExp("^(ipfs)://(.*)$","i"),UA=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),RA,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function QA(t,e){try{return Wm(YA(t,e))}catch(t){}return null}function YA(t,e){if("0x"===t)return null;const n=ey.from(Fp(t,e,e+32)).toNumber(),r=ey.from(Fp(t,n,n+32)).toNumber();return Fp(t,n+32,n+32+r)}function WA(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):TA.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function FA(t){const e=Pp(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function VA(t){if(t.length%32==0)return t;const e=new Uint8Array(32*Math.ceil(t.length/32));return e.set(t),e}function HA(t){const e=[];let n=0;for(let r=0;rey.from(t).eq(1))).catch((t=>{if(t.code===Lp.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t}))),this._supportsEip2544}_fetch(t,e){return kA(this,void 0,void 0,(function*(){const n={to:this.address,ccipReadEnabled:!0,data:Vp([t,Ng(this.name),e||"0x"])};let r=!1;var i;(yield this.supportsWildcard())&&(r=!0,n.data=Vp(["0x9061b923",HA([(i=this.name,Yp(_p(Ag(i).map((t=>{if(t.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const e=new Uint8Array(t.length+1);return e.set(t,1),e[0]=e.length-1,e}))))+"00"),n.data])]));try{let t=yield this.provider.call(n);return Pp(t).length%32==4&&TA.throwError("resolver threw error",Lp.errors.CALL_EXCEPTION,{transaction:n,data:t}),r&&(t=YA(t,0)),t}catch(t){if(t.code===Lp.errors.CALL_EXCEPTION)return null;throw t}}))}_fetchBytes(t,e){return kA(this,void 0,void 0,(function*(){const n=yield this._fetch(t,e);return null!=n?YA(n,0):null}))}_getAddress(t,e){const n=PA[String(t)];if(null==n&&TA.throwError(`unsupported coin type: ${t}`,Lp.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===n.ilk)return this.provider.formatter.address(e);const r=Pp(e);if(null!=n.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return BA(_p([[n.p2pkh],"0x"+t[2]]))}}if(null!=n.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return BA(_p([[n.p2sh],"0x"+t[2]]))}}if(null!=n.prefix){const t=r[1];let e=r[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&r.length===2+t&&t>=1&&t<=75){const t=NA.toWords(r.slice(2));return t.unshift(e),NA.encode(n.prefix,t)}}return null}getAddress(t){return kA(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t)try{const t=yield this._fetch("0x3b3b57de");return"0x"===t||"0x0000000000000000000000000000000000000000000000000000000000000000"===t?null:this.provider.formatter.callAddress(t)}catch(t){if(t.code===Lp.errors.CALL_EXCEPTION)return null;throw t}const e=yield this._fetchBytes("0xf1cb7e06",_A(t));if(null==e||"0x"===e)return null;const n=this._getAddress(t,e);return null==n&&TA.throwError("invalid or unsupported coin data",Lp.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),n}))}getAvatar(){return kA(this,void 0,void 0,(function*(){const t=[{type:"name",content:this.name}];try{const e=yield this.getText("avatar");if(null==e)return null;for(let n=0;nt[e]))}return TA.throwError("invalid or unsupported content hash data",Lp.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})}))}getText(t){return kA(this,void 0,void 0,(function*(){let e=Ym(t);e=_p([_A(64),_A(e.length),e]),e.length%32!=0&&(e=_p([e,Gp("0x",32-t.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",Yp(e));return null==n||"0x"===n?null:Wm(n)}))}}let qA=null,ZA=1;class JA extends Xg{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),My(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch((t=>{})),this._ready().catch((t=>{}));else{const e=Ay(new.target,"getNetwork")(t);e?(My(this,"_network",e),this.emit("network",e,null)):TA.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return kA(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||TA.throwError("no network detected",Lp.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:My(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return pA((()=>this._ready().then((t=>t),(t=>{if(t.code!==Lp.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))))}static getFormatter(){return null==qA&&(qA=new xA),qA}static getNetwork(t){return function(t){if(null==t)return null;if("number"==typeof t){for(const e in aA){const n=aA[e];if(n.chainId===t)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){const e=aA[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}const e=aA[t.name];if(!e)return"number"!=typeof t.chainId&&tA.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&tA.throwArgumentError("network chainId mismatch","network",t);let n=t._defaultProvider||null;var r;return null==n&&e._defaultProvider&&(n=(r=e._defaultProvider)&&"function"==typeof r.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:n}}(null==t?"homestead":t)}ccipReadFetch(t,e,n){return kA(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===n.length)return null;const r=t.to.toLowerCase(),i=e.toLowerCase(),o=[];for(let t=0;t=0?null:JSON.stringify({data:i,sender:r}),u=yield fA({url:a,errorPassThrough:!0},s,((t,e)=>(t.status=e.statusCode,t)));if(u.data)return u.data;const c=u.message||"unknown error";if(u.status>=400&&u.status<500)return TA.throwError(`response not found during CCIP fetch: ${c}`,Lp.errors.SERVER_ERROR,{url:e,errorMessage:c});o.push(c)}return TA.throwError(`error encountered during CCIP fetch: ${o.map((t=>JSON.stringify(t))).join(", ")}`,Lp.errors.SERVER_ERROR,{urls:n,errorMessages:o})}))}_getInternalBlockNumber(t){return kA(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const n=yield e;if(CA()-n.respTime<=t)return n.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=CA(),n=Ny({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((t=>null),(t=>t))}).then((({blockNumber:t,networkError:r})=>{if(r)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),r;const i=CA();return(t=ey.from(t).toNumber()){this._internalBlockNumber===n&&(this._internalBlockNumber=null)})),(yield n).blockNumber}))}poll(){return kA(this,void 0,void 0,(function*(){const t=ZA++,e=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(n),this.emit("poll",t,n),n!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)TA.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",TA.makeError("network block skew detected",Lp.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let t=this._emitted.block+1;t<=n;t++)this.emit("block",t);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&n-e>12&&delete this._emitted[t]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((t=>{switch(t.type){case"tx":{const n=t.hash;let r=this.getTransactionReceipt(n).then((t=>t&&null!=t.blockNumber?(this._emitted["t:"+n]=t.blockNumber,this.emit(n,t),null):null)).catch((t=>{this.emit("error",t)}));e.push(r);break}case"filter":if(!t._inflight){t._inflight=!0,-2===t._lastBlockNumber&&(t._lastBlockNumber=n-1);const r=t.filter;r.fromBlock=t._lastBlockNumber+1,r.toBlock=n;const i=r.toBlock-this._maxFilterBlockRange;i>r.fromBlock&&(r.fromBlock=i),r.fromBlock<0&&(r.fromBlock=0);const o=this.getLogs(r).then((e=>{t._inflight=!1,0!==e.length&&e.forEach((e=>{e.blockNumber>t._lastBlockNumber&&(t._lastBlockNumber=e.blockNumber),this._emitted["b:"+e.blockHash]=e.blockNumber,this._emitted["t:"+e.transactionHash]=e.blockNumber,this.emit(r,e)}))})).catch((e=>{this.emit("error",e),t._inflight=!1}));e.push(o)}}})),this._lastBlockNumber=n,Promise.all(e).then((()=>{this.emit("didPoll",t)})).catch((t=>{this.emit("error",t)}))}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return kA(this,void 0,void 0,(function*(){return TA.throwError("provider does not support network detection",Lp.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return kA(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",e,t),yield DA(0),this._network;const n=TA.makeError("underlying network changed",Lp.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",n),n}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((t=>{this._setFastBlockNumber(t)}),(t=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const t=CA();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&tthis._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,n){return kA(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,n||0,null)}))}_waitForTransaction(t,e,n,r){return kA(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(t);return(i?i.confirmations:0)>=e?i:new Promise(((i,o)=>{const a=[];let s=!1;const u=function(){return!!s||(s=!0,a.forEach((t=>{t()})),!1)},c=t=>{t.confirmations{this.removeListener(t,c)})),r){let n=r.startBlock,i=null;const c=a=>kA(this,void 0,void 0,(function*(){s||(yield DA(1e3),this.getTransactionCount(r.from).then((l=>kA(this,void 0,void 0,(function*(){if(!s){if(l<=r.nonce)n=a;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==i&&(i=n-3,i{s||this.once("block",c)})))}));if(s)return;this.once("block",c),a.push((()=>{this.removeListener("block",c)}))}if("number"==typeof n&&n>0){const t=setTimeout((()=>{u()||o(TA.makeError("timeout exceeded",Lp.errors.TIMEOUT,{timeout:n}))}),n);t.unref&&t.unref(),a.push((()=>{clearTimeout(t)}))}}))}))}getBlockNumber(){return kA(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return ey.from(t)}catch(e){return TA.throwError("bad result from backend",Lp.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Ny({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getBalance",n);try{return ey.from(r)}catch(t){return TA.throwError("bad result from backend",Lp.errors.SERVER_ERROR,{method:"getBalance",params:n,result:r,error:t})}}))}getTransactionCount(t,e){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Ny({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getTransactionCount",n);try{return ey.from(r).toNumber()}catch(t){return TA.throwError("bad result from backend",Lp.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:r,error:t})}}))}getCode(t,e){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Ny({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getCode",n);try{return Yp(r)}catch(t){return TA.throwError("bad result from backend",Lp.errors.SERVER_ERROR,{method:"getCode",params:n,result:r,error:t})}}))}getStorageAt(t,e,n){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Ny({address:this._getAddress(t),blockTag:this._getBlockTag(n),position:Promise.resolve(e).then((t=>Hp(t)))}),i=yield this.perform("getStorageAt",r);try{return Yp(i)}catch(t){return TA.throwError("bad result from backend",Lp.errors.SERVER_ERROR,{method:"getStorageAt",params:r,result:i,error:t})}}))}_wrapTransaction(t,e,n){if(null!=e&&32!==Wp(e))throw new Error("invalid response - sendTransaction");const r=t;return null!=e&&t.hash!==e&&TA.throwError("Transaction hash mismatch from Provider.sendTransaction.",Lp.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),r.wait=(e,r)=>kA(this,void 0,void 0,(function*(){let i;null==e&&(e=1),null==r&&(r=0),0!==e&&null!=n&&(i={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:n});const o=yield this._waitForTransaction(t.hash,e,r,i);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&TA.throwError("transaction failed",Lp.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),r}sendTransaction(t){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then((t=>Yp(t))),n=this.formatter.transaction(t);null==n.confirmations&&(n.confirmations=0);const r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(n,t,r)}catch(t){throw t.transaction=n,t.transactionHash=n.hash,t}}))}_getTransactionRequest(t){return kA(this,void 0,void 0,(function*(){const e=yield t,n={};return["from","to"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?this._getAddress(t):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?ey.from(t):null)))})),["type"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>null!=t?t:null)))})),e.accessList&&(n.accessList=this.formatter.accessList(e.accessList)),["data"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?Yp(t):null)))})),this.formatter.transactionRequest(yield Ny(n))}))}_getFilter(t){return kA(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach((n=>{null!=t[n]&&(e[n]=t[n])})),["fromBlock","toBlock"].forEach((n=>{null!=t[n]&&(e[n]=this._getBlockTag(t[n]))})),this.formatter.filter(yield Ny(e))}))}_call(t,e,n){return kA(this,void 0,void 0,(function*(){n>=10&&TA.throwError("CCIP read exceeded maximum redirections",Lp.errors.SERVER_ERROR,{redirects:n,transaction:t});const r=t.to,i=yield this.perform("call",{transaction:t,blockTag:e});if(n>=0&&"latest"===e&&null!=r&&"0x556f1830"===i.substring(0,10)&&Wp(i)%32==4)try{const o=Fp(i,4),a=Fp(o,0,32);ey.from(a).eq(r)||TA.throwError("CCIP Read sender did not match",Lp.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i});const s=[],u=ey.from(Fp(o,32,64)).toNumber(),c=ey.from(Fp(o,u,u+32)).toNumber(),l=Fp(o,u+32);for(let e=0;ekA(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",r);if(null==t)return null!=r.blockHash&&null==this._emitted["b:"+r.blockHash]||null!=r.blockTag&&n>this._emitted.block?null:void 0;if(e){let e=null;for(let n=0;nthis._wrapTransaction(t))),n}return this.formatter.block(t)}))),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return kA(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return pA((()=>kA(this,void 0,void 0,(function*(){const n=yield this.perform("getTransaction",e);if(null==n)return null==this._emitted["t:"+t]?null:void 0;const r=this.formatter.transactionResponse(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;t<=0&&(t=1),r.confirmations=t}return this._wrapTransaction(r)}))),{oncePoll:this})}))}getTransactionReceipt(t){return kA(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return pA((()=>kA(this,void 0,void 0,(function*(){const n=yield this.perform("getTransactionReceipt",e);if(null==n)return null==this._emitted["t:"+t]?null:void 0;if(null==n.blockHash)return;const r=this.formatter.receipt(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;t<=0&&(t=1),r.confirmations=t}return r}))),{oncePoll:this})}))}getLogs(t){return kA(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Ny({filter:this._getFilter(t)}),n=yield this.perform("getLogs",e);return n.forEach((t=>{null==t.removed&&(t.removed=!1)})),xA.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)}))}getEtherPrice(){return kA(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return kA(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&TA.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return kA(this,void 0,void 0,(function*(){let e=t;for(;;){if(""===e||"."===e)return null;if("eth"!==t&&"eth"===e)return null;const n=yield this._getResolver(e,"getResolver");if(null!=n){const r=new GA(this,n,t);return e===t||(yield r.supportsWildcard())?r:null}e=e.split(".").slice(1).join(".")}}))}_getResolver(t,e){return kA(this,void 0,void 0,(function*(){null==e&&(e="ENS");const n=yield this.getNetwork();n.ensAddress||TA.throwError("network does not support ENS",Lp.errors.UNSUPPORTED_OPERATION,{operation:e,network:n.name});try{const e=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+Ng(t).substring(2)});return this.formatter.callAddress(e)}catch(t){}return null}))}resolveName(t){return kA(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if(Up(t))throw e}"string"!=typeof t&&TA.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return kA(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(e,"lookupAddress");if(null==n)return null;const r=QA(yield this.call({to:n,data:"0x691f3431"+Ng(e).substring(2)}),0);return(yield this.resolveName(r))!=t?null:r}))}getAvatar(t){return kA(this,void 0,void 0,(function*(){let e=null;if(Up(t)){const n=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(n,"getAvatar");if(!r)return null;e=new GA(this,r,n);try{const t=yield e.getAvatar();if(t)return t.url}catch(t){if(t.code!==Lp.errors.CALL_EXCEPTION)throw t}try{const t=QA(yield this.call({to:r,data:"0x691f3431"+Ng(n).substring(2)}),0);e=yield this.getResolver(t)}catch(t){if(t.code!==Lp.errors.CALL_EXCEPTION)throw t;return null}}else if(e=yield this.getResolver(t),!e)return null;const n=yield e.getAvatar();return null==n?null:n.url}))}perform(t,e){return TA.throwError(t+" not implemented",Lp.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_stopEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_addEventListener(t,e,n){const r=new zA(jA(t),e,n);return this._events.push(r),this._startEvent(r),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let n=!1,r=[],i=jA(t);return this._events=this._events.filter((t=>t.tag!==i||(setTimeout((()=>{t.listener.apply(this,e)}),0),n=!0,!t.once||(r.push(t),!1)))),r.forEach((t=>{this._stopEvent(t)})),n}listenerCount(t){if(!t)return this._events.length;let e=jA(t);return this._events.filter((t=>t.tag===e)).length}listeners(t){if(null==t)return this._events.map((t=>t.listener));let e=jA(t);return this._events.filter((t=>t.tag===e)).map((t=>t.listener))}off(t,e){if(null==e)return this.removeAllListeners(t);const n=[];let r=!1,i=jA(t);return this._events=this._events.filter((t=>t.tag!==i||t.listener!=e||(!!r||(r=!0,n.push(t),!1)))),n.forEach((t=>{this._stopEvent(t)})),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const n=jA(t);this._events=this._events.filter((t=>t.tag!==n||(e.push(t),!1)))}return e.forEach((t=>{this._stopEvent(t)})),this}}var XA=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const KA=new Lp(IA),$A=["call","estimateGas"];function tN(t,e){if(null==t)return null;if("string"==typeof t.message&&t.message.match("reverted")){const n=Up(t.data)?t.data:null;if(!e||n)return{message:t.message,data:n}}if("object"==typeof t){for(const n in t){const r=tN(t[n],e);if(r)return r}return null}if("string"==typeof t)try{return tN(JSON.parse(t),e)}catch(t){}return null}function eN(t,e,n){const r=n.transaction||n.signedTransaction;if("call"===t){const t=tN(e,!0);if(t)return t.data;KA.throwError("missing revert data in call exception; Transaction reverted without a reason string",Lp.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if("estimateGas"===t){let n=tN(e.body,!1);null==n&&(n=tN(e,!1)),n&&KA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Lp.errors.UNPREDICTABLE_GAS_LIMIT,{reason:n.message,method:t,transaction:r,error:e})}let i=e.message;throw e.code===Lp.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?i=e.error.message:"string"==typeof e.body?i=e.body:"string"==typeof e.responseText&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&KA.throwError("insufficient funds for intrinsic transaction cost",Lp.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),i.match(/nonce (is )?too low/i)&&KA.throwError("nonce has already been used",Lp.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&KA.throwError("replacement fee too low",Lp.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),i.match(/only replay-protected/i)&&KA.throwError("legacy pre-eip-155 transactions not supported",Lp.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:r}),$A.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&KA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Lp.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}function nN(t){return new Promise((function(e){setTimeout(e,t)}))}function rN(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function iN(t){return t?t.toLowerCase():t}const oN={};class aN extends nv{constructor(t,e,n){if(super(),t!==oN)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");My(this,"provider",e),null==n&&(n=0),"string"==typeof n?(My(this,"_address",this.provider.formatter.address(n)),My(this,"_index",null)):"number"==typeof n?(My(this,"_index",n),My(this,"_address",null)):KA.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(t){return KA.throwError("cannot alter JSON-RPC Signer connection",Lp.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new sN(oN,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((t=>(t.length<=this._index&&KA.throwError("unknown account #"+this._index,Lp.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index]))))}sendUncheckedTransaction(t){t=Iy(t);const e=this.getAddress().then((t=>(t&&(t=t.toLowerCase()),t)));if(null==t.gasLimit){const n=Iy(t);n.from=e,t.gasLimit=this.provider.estimateGas(n)}return null!=t.to&&(t.to=Promise.resolve(t.to).then((t=>XA(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.provider.resolveName(t);return null==e&&KA.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))))),Ny({tx:Ny(t),sender:e}).then((({tx:e,sender:n})=>{null!=e.from?e.from.toLowerCase()!==n&&KA.throwArgumentError("from address mismatch","transaction",t):e.from=n;const r=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[r]).then((t=>t),(t=>("string"==typeof t.message&&t.message.match(/user denied/i)&&KA.throwError("user rejected transaction",Lp.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:e}),eN("sendTransaction",t,r))))}))}signTransaction(t){return KA.throwError("signing transactions is unsupported",Lp.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return XA(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(t);try{return yield pA((()=>XA(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(n);if(null!==t)return this.provider._wrapTransaction(t,n,e)}))),{oncePoll:this.provider})}catch(t){throw t.transactionHash=n,t}}))}signMessage(t){return XA(this,void 0,void 0,(function*(){const e="string"==typeof t?Ym(t):t,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[Yp(e),n.toLowerCase()])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&KA.throwError("user rejected signing",Lp.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:t}),e}}))}_legacySignMessage(t){return XA(this,void 0,void 0,(function*(){const e="string"==typeof t?Ym(t):t,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),Yp(e)])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&KA.throwError("user rejected signing",Lp.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:t}),e}}))}_signTypedData(t,e,n){return XA(this,void 0,void 0,(function*(){const r=yield Rg.resolveNames(t,e,n,(t=>this.provider.resolveName(t))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(Rg.getPayload(r.domain,e,r.value))])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&KA.throwError("user rejected signing",Lp.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:r.domain,types:e,value:r.value}}),t}}))}unlock(t){return XA(this,void 0,void 0,(function*(){const e=this.provider,n=yield this.getAddress();return e.send("personal_unlockAccount",[n.toLowerCase(),t,null])}))}}class sN extends aN{sendTransaction(t){return this.sendUncheckedTransaction(t).then((t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)})))}}const uN={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class cN extends JA{constructor(t,e){let n=e;null==n&&(n=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then((e=>{t(e)}),(t=>{e(t)}))}),0)}))),super(n),t||(t=Ay(this.constructor,"defaultUrl")()),My(this,"connection","string"==typeof t?Object.freeze({url:t}):Object.freeze(Iy(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return XA(this,void 0,void 0,(function*(){yield nN(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=Ay(this.constructor,"getNetwork");try{return e(ey.from(t).toNumber())}catch(e){return KA.throwError("could not detect network",Lp.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return KA.throwError("could not detect network",Lp.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new aN(oN,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((t=>t.map((t=>this.formatter.address(t)))))}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Ty(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(r&&this._cache[t])return this._cache[t];const i=fA(this.connection,JSON.stringify(n),rN).then((t=>(this.emit("debug",{action:"response",request:n,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:n,provider:this}),t}));return r&&(this._cache[t]=i,setTimeout((()=>{this._cache[t]=null}),0)),i}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[iN(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[iN(e.address),e.blockTag]];case"getCode":return["eth_getCode",[iN(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[iN(e.address),Gp(e.position,32),e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[Ay(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[Ay(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=iN(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return XA(this,void 0,void 0,(function*(){if("call"===t||"estimateGas"===t){const t=e.transaction;if(t&&null!=t.type&&ey.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const n=yield this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&((e=Iy(e)).transaction=Iy(t),delete e.transaction.type)}}const n=this.prepareRequest(t,e);null==n&&KA.throwError(t+" not implemented",Lp.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(n[0],n[1])}catch(n){return eN(t,n,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(n){return function r(){t.send("eth_getFilterChanges",[n]).then((function(n){if(t._pendingFilter!=e)return null;let r=Promise.resolve();return n.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",r=r.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),r.then((function(){return nN(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){r()}),0),null;t.send("eth_uninstallFilter",[n])})).catch((t=>{}))}(),n})).catch((t=>{}))}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const n=Iy(uN);if(e)for(const t in e)e[t]&&(n[t]=!0);var r,i;i=n,(r=t)&&"object"==typeof r||by.throwArgumentError("invalid object","object",r),Object.keys(r).forEach((t=>{i[t]||by.throwArgumentError("invalid object key - "+t,"transaction:"+t,r)}));const o={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(e){if(null==t[e])return;const n=Hp(ey.from(t[e]));"gasLimit"===e&&(e="gas"),o[e]=n})),["from","to","data"].forEach((function(e){null!=t[e]&&(o[e]=Yp(t[e]))})),t.accessList&&(o.accessList=jM(t.accessList)),o}}const lN=new Lp(IA);let hN=1;function dN(t,e){const n="Web3LegacyFetcher";return function(t,r){const i={method:t,params:r,id:hN++,jsonrpc:"2.0"};return new Promise(((t,r)=>{this.emit("debug",{action:"request",fetcher:n,request:Ty(i),provider:this}),e(i,((e,o)=>{if(e)return this.emit("debug",{action:"response",fetcher:n,error:e,request:i,provider:this}),r(e);if(this.emit("debug",{action:"response",fetcher:n,request:i,response:o,provider:this}),o.error){const t=new Error(o.error.message);return t.code=o.error.code,t.data=o.error.data,r(t)}t(o.result)}))}))}}class fN extends cN{constructor(t,e){null==t&&lN.throwArgumentError("missing provider","provider",t);let n=null,r=null,i=null;"function"==typeof t?(n="unknown:",r=t):(n=t.host||t.path||"",!n&&t.isMetaMask&&(n="metamask"),i=t,t.request?(""===n&&(n="eip-1193:"),r=function(t){return function(e,n){null==n&&(n=[]);const r={method:e,params:n};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:Ty(r),provider:this}),t.request(r).then((t=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:t,provider:this}),t}))}}(t)):t.sendAsync?r=dN(0,t.sendAsync.bind(t)):t.send?r=dN(0,t.send.bind(t)):lN.throwArgumentError("unsupported provider","provider",t),n||(n="unknown:")),super(n,e),My(this,"jsonRpcFetchFunc",r),My(this,"provider",i)}send(t,e){return this.jsonRpcFetchFunc(t,e)}}const pN=new RegExp("^bytes([0-9]+)$"),yN=new RegExp("^(u?int)([0-9]*)$"),mN=new RegExp("^(.*)\\[([0-9]*)\\]$"),gN=new Lp("solidity/5.7.0");function vN(t,e,n){switch(t){case"address":return n?Rp(e,32):Pp(e);case"string":return Ym(e);case"bytes":return Pp(e);case"bool":return e=e?"0x01":"0x00",n?Rp(e,32):Pp(e)}let r=t.match(yN);if(r){let i=parseInt(r[2]||"256");return(r[2]&&String(i)!==r[2]||i%8!=0||0===i||i>256)&&gN.throwArgumentError("invalid number type","type",t),n&&(i=256),Rp(e=ey.from(e).toTwos(i),i/8)}if(r=t.match(pN),r){const i=parseInt(r[1]);return(String(i)!==r[1]||0===i||i>32)&&gN.throwArgumentError("invalid bytes type","type",t),Pp(e).byteLength!==i&&gN.throwArgumentError(`invalid value for ${t}`,"value",e),n?Pp((e+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):e}if(r=t.match(mN),r&&Array.isArray(e)){const n=r[1];parseInt(r[2]||String(e.length))!=e.length&&gN.throwArgumentError(`invalid array length for ${t}`,"value",e);const i=[];return e.forEach((function(t){i.push(vN(n,t,!0))})),_p(i)}return gN.throwArgumentError("invalid type","type",t)}function wN(t,e){t.length!=e.length&&gN.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const n=[];return t.forEach((function(t,r){n.push(vN(t,e[r]))})),Yp(_p(n))}const bN=new Lp("units/5.7.0"),MN=["wei","kwei","mwei","gwei","szabo","finney","ether"];function AN(t,e){if("string"==typeof e){const t=MN.indexOf(e);-1!==t&&(e=3*t)}return fy(t,null!=e?e:18)}function NN(t,e){if("string"!=typeof t&&bN.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=MN.indexOf(e);-1!==t&&(e=3*t)}return py(t,null!=e?e:18)}let IN,EN=()=>IN||(IN="object"==typeof r?r:window,IN);const xN=()=>(void 0===EN()._Web3ClientConfiguration&&(EN()._Web3ClientConfiguration={}),EN()._Web3ClientConfiguration);function kN(t){let e,n=t[0],r=1;for(;rn.call(e,...t))),e=void 0)}return n}class TN extends cN{constructor(t,e,n,r){super(t),this._network=e,this._endpoint=t,this._endpoints=n,this._failover=r,this._pendingBatch=[]}detectNetwork(){return Promise.resolve(tp.findByName(this._network).id)}requestChunk(t,e,n){try{const r=t.map((t=>t.request));return fA(e,JSON.stringify(r)).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(kN([r,"optionalAccess",t=>t.error])){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else kN([r,"optionalAccess",t=>t.result])?t.resolve(r.result):t.reject()}))})).catch((e=>{if(n<3&&e&&"SERVER_ERROR"==e.code){const e=this._endpoints.indexOf(this._endpoint)+1;this._failover(),this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this.requestChunk(t,this._endpoint,n+1)}else t.forEach((t=>{t.reject(e)}))}))}catch(e){t.forEach((t=>{t.reject()}))}}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const e=[];for(let n=0;n(t.map((t=>t.request)),this.requestChunk(t,this._endpoint,1))))}),xN().batchInterval||10)),i}}const LN=()=>(null==EN()._Web3ClientProviders&&(EN()._Web3ClientProviders={}),EN()._Web3ClientProviders),SN=(t,e)=>{void 0===LN()[t]&&(LN()[t]=[]);const n=LN()[t].indexOf(e);n>-1&&LN()[t].splice(n,1),LN()[t].unshift(e)},jN=async(t,e,n=!0)=>{let r;LN()[t]=e.map(((r,i)=>new TN(r,t,e,(()=>{1===LN()[t].length?jN(t,e,n):LN()[t].splice(i,1)}))));let i=EN();if(null==i.fetch||void 0!==k&&k.env&&"test"==k.env.NODE_ENV||void 0!==i.cy||!1===n)r=LN()[t][0];else{let n=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},referrer:"",referrerPolicy:"no-referrer",body:JSON.stringify({method:"net_version",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const i=Math.min(...n),o=n.indexOf(i);r=LN()[t][o]}SN(t,r)};var CN={getProvider:async t=>{let e=LN();if(e&&e[t])return e[t][0];let n=EN();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[t]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[t]=new Promise((async e=>{await jN(t,tp[t].endpoints),e(EN()._Web3ClientProviders[t][0])}))),await n._Web3ClientGetProviderPromise[t]},getProviders:async t=>{let e=LN();if(e&&e[t])return e[t];let n=EN();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[t]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[t]=new Promise((async e=>{await jN(t,tp[t].endpoints),e(EN()._Web3ClientProviders[t])}))),await n._Web3ClientGetProvidersPromise[t]},setProviderEndpoints:jN,setProvider:SN};class DN extends eh{constructor(t,e,n,r){super(t),this._provider=new eh(t),this._network=e,this._endpoint=t,this._endpoints=n,this._failover=r,this._pendingBatch=[],this._rpcRequest=this._rpcRequestReplacement.bind(this)}handleError(t,e,n){if(e<3&&t&&["Failed to fetch","limit reached","504","503","502","500","429","426","422","413","409","408","406","405","404","403","402","401","400"].some((e=>t.toString().match(e)))){const t=this._endpoints.indexOf(this._endpoint)+1;this._endpoint=t>=this._endpoints.length?this._endpoints[0]:this._endpoints[t],this._provider=new eh(this._endpoint),this.requestChunk(n,e+1)}else n.forEach((e=>{e.reject(t)}))}batchRequest(t,e){return new Promise(((e,n)=>{0===t.length&&e([]);const r=t.map((t=>this._rpcClient.request(t.methodName,t.args)));fetch(this._endpoint,{method:"POST",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}}).then((t=>{t.ok?t.json().then((t=>{e(t)})).catch(n):n(`${t.status} ${t.text}`)})).catch(n)}))}requestChunk(t,e){const n=t.map((t=>t.request));try{return this.batchRequest(n,e).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(function(t){let e,n=t[0],r=1;for(;rn.call(e,...t))),e=void 0)}return n}([r,"optionalAccess",t=>t.error])){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else r?t.resolve(r):t.reject()}))})).catch((n=>this.handleError(n,e,t)))}catch(n){return this.handleError(n,e,t)}}_rpcRequestReplacement(t,e){const n={methodName:t,args:e};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const e=[];for(let n=0;n(t.map((t=>t.request)),this.requestChunk(t,1))))}),xN().batchInterval||10)),i}}const ON=()=>(null==EN()._Web3ClientProviders&&(EN()._Web3ClientProviders={}),EN()._Web3ClientProviders),zN=(t,e)=>{void 0===ON()[t]&&(ON()[t]=[]);const n=ON()[t].indexOf(e);n>-1&&ON()[t].splice(n,1),ON()[t].unshift(e)},PN=async(t,e,n=!0)=>{let r;ON()[t]=e.map(((r,i)=>new DN(r,t,e,(()=>{1===ON()[t].length?PN(t,e,n):ON()[t].splice(i,1)}))));let i=EN();if(null==i.fetch||void 0!==k&&k.env&&"test"==k.env.NODE_ENV||void 0!==i.cy||!1===n)r=ON()[t][0];else{let n=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},referrer:"",referrerPolicy:"no-referrer",body:JSON.stringify({method:"getIdentity",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const i=Math.min(...n),o=n.indexOf(i);r=ON()[t][o]}zN(t,r)};var _N={getProvider:async t=>{let e=ON();if(e&&e[t])return e[t][0];let n=EN();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[t]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[t]=new Promise((async e=>{await PN(t,tp[t].endpoints),e(EN()._Web3ClientProviders[t][0])}))),await n._Web3ClientGetProviderPromise[t]},getProviders:async t=>{let e=ON();if(e&&e[t])return e[t];let n=EN();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[t]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[t]=new Promise((async e=>{await PN(t,tp[t].endpoints),e(EN()._Web3ClientProviders[t])}))),await n._Web3ClientGetProvidersPromise[t]},setProviderEndpoints:PN,setProvider:zN};let BN=["ethereum","bsc","polygon","solana","fantom","arbitrum","avalanche","gnosis","optimism","base"];BN.evm=["ethereum","bsc","polygon","fantom","arbitrum","avalanche","gnosis","optimism","base"],BN.solana=["solana"];let RN=()=>(null==EN()._Web3ClientCacheStore&&(EN()._Web3ClientCacheStore={}),EN()._Web3ClientCacheStore),UN=()=>(null==EN()._Web3ClientPromiseStore&&(EN()._Web3ClientPromiseStore={}),EN()._Web3ClientPromiseStore),QN=function({key:t}){UN()[t]=void 0},YN=function({call:t,key:e,expires:n=0}){return new Promise(((r,i)=>{let o,a=function({key:t}){return UN()[t]}({key:e=JSON.stringify(e)});if(a)return a.then(r).catch(i);(function({key:t,promise:e}){return UN()[t]=e,e})({key:e,promise:new Promise(((a,s)=>0===n?t().then((t=>{r(t),a(t)})).catch((t=>{i(t),s(t)})):(o=function({key:t,expires:e}){let n=RN()[t];if(function(t){let e,n=t[0],r=1;for(;rn.call(e,...t))),e=void 0)}return n}([n,"optionalAccess",t=>t.expiresAt])>Date.now())return n.value}({key:e,expires:n}),o?(r(o),a(o),o):void t().then((t=>{t&&function({key:t,value:e,expires:n}){RN()[t]={expiresAt:Date.now()+n,value:e}}({key:e,value:t,expires:n}),r(t),a(t)})).catch((t=>{i(t),s(t)})))))}).then((()=>{QN({key:e})})).catch((()=>{QN({key:e})}))}))};const WN=async t=>{if(BN.evm.includes(t))return await CN.getProvider(t);if(BN.solana.includes(t))return await _N.getProvider(t);throw"Unknown blockchain: "+t},FN=t=>`(${t.map((t=>"tuple"===t.type?FN(t.components):t.type)).join(",")})`;var VN=({provider:t,from:e,to:n,value:r,method:i,api:o,params:a})=>{if(void 0===o)return t.estimateGas({from:e,to:n,value:r});{let s=new JM(n,o,t),u=s.interface.fragments.find((t=>t.name==i)),c=(({contract:t,method:e,params:n})=>{let r=t.interface.fragments.find((t=>t.name==e));return n instanceof Array?n:n instanceof Object?r.inputs.map((t=>n[t.name])):void 0})({contract:s,method:i,params:a});void 0===s[i]&&(i=`${i}(${u.inputs.map((t=>"tuple"===t.type?FN(t.components):t.type)).join(",")})`);let l=s.estimateGas[i];return c?l(...c,{from:e,value:r}):l({from:e,value:r})}};let HN=async function({blockchain:t,from:e,to:n,value:r,method:i,api:o,params:a,cache:s}){if(!BN.includes(t))throw"Unknown blockchain: "+t;void 0===r&&(r="0");const u=await WN(t);return await YN({expires:s||0,key:[t,e,n,r,i,a],call:async()=>VN({provider:u,from:e,to:n,value:r,method:i,api:o,params:a})})};const GN=({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=new JM(t,e,i),s=(({contract:t,method:e,params:n})=>t.interface.fragments.find((t=>t.name==e)).inputs.map(((t,e)=>Array.isArray(n)?n[e]:n[t.name])))({contract:a,method:n,params:r}),u=a.interface.fragments.find((t=>t.name===n));return void 0===a[n]&&(n=`${n}(${u.inputs.map((t=>t.type)).join(",")})`),u&&"nonpayable"===u.stateMutability?a.callStatic[n](...s,{blockTag:o}):a[n](...s,{blockTag:o})},qN=({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a})=>n?GN({address:e,api:n,method:r,params:i,provider:a,block:o}):"latestBlockNumber"===r?a.getBlockNumber():"balance"===r?(({address:t,provider:e})=>e.getBalance(t))({address:e,provider:a}):"transactionCount"===r?(({address:t,provider:e})=>e.getTransactionCount(t))({address:e,provider:a}):void 0;const ZN=async({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a,providers:s})=>{try{if(null==r||"getAccountInfo"===r)return null==n&&(n=df),await(async({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=await i.getAccountInfo(new eu(t));if(a&&a.data)return e.decode(a.data)})({address:e,api:n,method:r,params:i,provider:a,block:o});if("getProgramAccounts"===r)return await a.getProgramAccounts(new eu(e),i).then((t=>n?t.map((t=>(t.data=n.decode(t.account.data),t))):t));if("getTokenAccountBalance"===r)return await a.getTokenAccountBalance(new eu(e));if("latestBlockNumber"===r)return await a.getSlot(i||void 0);if("balance"===r)return await(({address:t,provider:e})=>e.getBalance(new eu(t)))({address:e,provider:a})}catch(u){if(s&&u&&["Failed to fetch","limit reached","504","503","502","500","429","426","422","413","409","408","406","405","404","403","402","401","400"].some((t=>u.toString().match(t)))){let u=s[s.indexOf(a)+1]||s[0];return ZN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:u,providers:s})}throw u}};const JN=async function(t,e){const{blockchain:n,address:r,method:i}=(t=>{if("object"==typeof t)return t;let e=t.match(/(?\w+):\/\/(?[\w\d]+)(\/(?[\w\d]+)*)?/);return null==e.groups.part2?e.groups.part1.match(/\d/)?{blockchain:e.groups.blockchain,address:e.groups.part1}:{blockchain:e.groups.blockchain,method:e.groups.part1}:{blockchain:e.groups.blockchain,address:e.groups.part1,method:e.groups.part2}})(t),{api:o,params:a,cache:s,block:u,timeout:c,strategy:l,cacheKey:h}=("object"==typeof t?t:e)||{};return await YN({expires:s||0,key:h||[n,r,i,a,u],call:async()=>{if(BN.evm.includes(n))return await(async({blockchain:t,address:e,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{if(s=s||xN().strategy||"failover",a=a||xN().timeout||void 0,"fastest"===s){const s=await CN.getProviders(t);let u=[];const c=s.map((a=>new Promise((s=>{u.push(qN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a}).then(s))})))),l=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a||1e4)));return u=Promise.all(u.map((t=>new Promise((e=>{t.catch(e)}))))).then((()=>{})),Promise.race([...c,l,u])}{const s=await CN.getProvider(t),u=qN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:s});return a?(a=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a))),Promise.race([u,a])):u}})({blockchain:n,address:r,api:o,method:i,params:a,block:u,strategy:l,timeout:c});if(BN.solana.includes(n))return await(async({blockchain:t,address:e,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{s=s||xN().strategy||"failover",a=a||xN().timeout||void 0;const u=await _N.getProviders(t);if("fastest"===s){let s=[];const c=u.map((a=>new Promise((u=>{s.push(ZN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a}).then(u))})))),l=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a||1e4)));return s=Promise.all(s.map((t=>new Promise((e=>{t.catch(e)}))))).then((()=>{})),Promise.race([...c,l,s])}{const s=await _N.getProvider(t),c=ZN({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:s,providers:u});return a?(a=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a))),Promise.race([c,a])):c}})({blockchain:n,address:r,api:o,method:i,params:a,block:u,strategy:l,timeout:c});throw"Unknown blockchain: "+n}})};var XN=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.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 i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));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=128)}([function(t,e,n){(function(t,r,i){n.d(e,"a",(function(){return Xi})),n.d(e,"b",(function(){return da})),n.d(e,"c",(function(){return to})),n.d(e,"d",(function(){return Lo})),n.d(e,"e",(function(){return ot})),n.d(e,"f",(function(){return $})),n.d(e,"g",(function(){return Hi})),n.d(e,"h",(function(){return tt})),n.d(e,"i",(function(){return ao})),n.d(e,"j",(function(){return uo})),n.d(e,"k",(function(){return ro})),n.d(e,"l",(function(){return co})),n.d(e,"m",(function(){return so})),n.d(e,"n",(function(){return st})),n.d(e,"o",(function(){return rt})),n.d(e,"p",(function(){return Qi})),n.d(e,"q",(function(){return Z})),n.d(e,"r",(function(){return nt})),n.d(e,"s",(function(){return ko})),n.d(e,"t",(function(){return eo})),n.d(e,"u",(function(){return no})),n.d(e,"v",(function(){return G})),n.d(e,"w",(function(){return H})),n.d(e,"x",(function(){return Zi})),n.d(e,"y",(function(){return lt})),n.d(e,"z",(function(){return Ri})),n.d(e,"A",(function(){return Co})),n.d(e,"B",(function(){return qi})),n.d(e,"C",(function(){return Bi})),n.d(e,"D",(function(){return Ji})),n.d(e,"E",(function(){return yo})),n.d(e,"F",(function(){return po})),n.d(e,"G",(function(){return Do})),n.d(e,"H",(function(){return ct})),n.d(e,"I",(function(){return io})),n.d(e,"J",(function(){return oo})),n.d(e,"K",(function(){return F})),n.d(e,"L",(function(){return aa})),n.d(e,"M",(function(){return at})),n.d(e,"N",(function(){return Y})),n.d(e,"O",(function(){return ca})),n.d(e,"P",(function(){return Yo})),n.d(e,"Q",(function(){return W})),n.d(e,"R",(function(){return Ro})),n.d(e,"S",(function(){return Wo})),n.d(e,"T",(function(){return fo})),n.d(e,"U",(function(){return Po})),n.d(e,"V",(function(){return Oo})),n.d(e,"W",(function(){return Fo})),n.d(e,"X",(function(){return $o})),n.d(e,"Y",(function(){return na})),n.d(e,"Z",(function(){return Xo})),n.d(e,"ab",(function(){return qo})),n.d(e,"bb",(function(){return ra})),n.d(e,"cb",(function(){return oa})),n.d(e,"db",(function(){return ia})),n.d(e,"eb",(function(){return zo})),n.d(e,"fb",(function(){return Ko})),n.d(e,"gb",(function(){return Zo})),n.d(e,"hb",(function(){return Jo})),n.d(e,"ib",(function(){return ta})),n.d(e,"jb",(function(){return ua})),n.d(e,"kb",(function(){return Go})),n.d(e,"lb",(function(){return ea})),n.d(e,"mb",(function(){return _o})),n.d(e,"nb",(function(){return Qo})),n.d(e,"ob",(function(){return X})),n.d(e,"pb",(function(){return Gi})),n.d(e,"qb",(function(){return K})),n.d(e,"rb",(function(){return S})),n.d(e,"sb",(function(){return it})),n.d(e,"tb",(function(){return Eo})),n.d(e,"ub",(function(){return la})),n.d(e,"vb",(function(){return lo})),n.d(e,"wb",(function(){return ho})),n.d(e,"xb",(function(){return Ui}));var o=n(71),a=n(1),s=n(21),u=n(68),c=n(32),l=n(43),h=n(69),d=n(24),f=n(38),p=n(44),y=n(5),m=n(70);function g(t,e,n){return(e=M(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){for(var n=0;n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function N(t){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function I(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=k(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function E(t){return function(t){if(Array.isArray(t))return T(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||k(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(t,e)||k(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(t,e){if(t){if("string"==typeof t)return T(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T(t,e):void 0}}function T(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:a.FIVE_MINUTES,i=arguments.length>1?arguments[1]:void 0,o=Object(a.toMiliseconds)(r||a.FIVE_MINUTES);return{resolve:function(e){n&&t&&(clearTimeout(n),t(e))},reject:function(t){n&&e&&(clearTimeout(n),e(t))},done:function(){return new Promise((function(r,a){n=setTimeout((function(){a(new Error(i))}),o),t=r,e=a}))}}}function tt(t,e,n){var r=this;return new Promise((function(i,o){return L(r,null,A().mark((function r(){var a,s;return A().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=setTimeout((function(){return o(new Error(n))}),e),r.prev=1,r.next=4,t;case 4:s=r.sent,i(s),r.next=11;break;case 8:r.prev=8,r.t0=r.catch(1),o(r.t0);case 11:clearTimeout(a);case 12:case"end":return r.stop()}}),r,null,[[1,8]])})))}))}function et(t,e){if("string"==typeof e&&e.startsWith("".concat(t,":")))return e;if("topic"===t.toLowerCase()){if("string"!=typeof e)throw new Error('Value must be "string" for expirer target type: topic');return"topic:".concat(e)}if("id"===t.toLowerCase()){if("number"!=typeof e)throw new Error('Value must be "number" for expirer target type: id');return"id:".concat(e)}throw new Error("Unknown expirer target type: ".concat(t))}function nt(t){return et("topic",t)}function rt(t){return et("id",t)}function it(t){var e=x(t.split(":"),2),n=e[0],r=e[1],i={id:void 0,topic:void 0};if("topic"===n&&"string"==typeof r)i.topic=r;else{if("id"!==n||!Number.isInteger(Number(r)))throw new Error("Invalid target, expected id:number or topic:string, got ".concat(n,":").concat(r));i.id=Number(r)}return i}function ot(t,e){return Object(a.fromMiliseconds)((e||Date.now())+Object(a.toMiliseconds)(t))}function at(t){return Date.now()>=Object(a.toMiliseconds)(t)}function st(t,e){return"".concat(t).concat(e?":".concat(e):"")}function ut(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return E(new Set([].concat(E(t),E(e))))}function ct(t){return L(this,arguments,(function(t){var e=t.id,n=t.topic,i=t.wcDeepLink;return A().mark((function t(){var o,a,s,u;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,i){t.next=3;break}return t.abrupt("return");case 3:if(o="string"==typeof i?JSON.parse(i):i,"string"==typeof(a=null==o?void 0:o.href)){t.next=7;break}return t.abrupt("return");case 7:if(a.endsWith("/")&&(a=a.slice(0,-1)),s="".concat(a,"/wc?requestId=").concat(e,"&sessionTopic=").concat(n),(u=V())!==U){t.next=13;break}s.startsWith("https://")||s.startsWith("http://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"),t.next=17;break;case 13:if(t.t0=u===B&&N(null==r?void 0:r.Linking)<"u",!t.t0){t.next=17;break}return t.next=17,r.Linking.openURL(s);case 17:t.next=22;break;case 19:t.prev=19,t.t1=t.catch(0),console.error(t.t1);case 22:case"end":return t.stop()}}),t,null,[[0,19]])}))()}))}function lt(t,e){return L(this,null,A().mark((function n(){return A().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,t.getItem(e);case 3:if(n.t0=n.sent,n.t0){n.next=6;break}n.t0=F()?localStorage.getItem(e):void 0;case 6:return n.abrupt("return",n.t0);case 9:n.prev=9,n.t1=n.catch(0),console.error(n.t1);case 12:case"end":return n.stop()}}),n,null,[[0,9]])})))}var ht=("undefined"==typeof globalThis?"undefined":N(globalThis))<"u"?globalThis:("undefined"==typeof window?"undefined":N(window))<"u"?window:(void 0===r?"undefined":N(r))<"u"?r:("undefined"==typeof self?"undefined":N(self))<"u"?self:{},dt={exports:{}};!function(e){!function(){var n="input is invalid type",r="object"==("undefined"==typeof window?"undefined":N(window)),i=r?window:{};i.JS_SHA3_NO_WINDOW&&(r=!1);var o=!r&&"object"==("undefined"==typeof self?"undefined":N(self));!i.JS_SHA3_NO_NODE_JS&&"object"==(void 0===t?"undefined":N(t))&&t.versions&&t.versions.node?i=ht:o&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&e.exports,s=!i.JS_SHA3_NO_ARRAY_BUFFER&&("undefined"==typeof ArrayBuffer?"undefined":N(ArrayBuffer))<"u",u="0123456789abcdef".split(""),c=[4,1024,262144,67108864],l=[0,8,16,24],h=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],f=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],y={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),s&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return"object"==N(t)&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var m=function(t,e,n){return function(r){return new C(t,e,t).update(r)[n]()}},g=function(t,e,n){return function(r,i){return new C(t,e,i).update(r)[n]()}},v=function(t,e,n){return function(e,r,i,o){return I["cshake"+t].update(e,r,i,o)[n]()}},w=function(t,e,n){return function(e,r,i,o){return I["kmac"+t].update(e,r,i,o)[n]()}},b=function(t,e,n,r){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function D(t,e,n){C.call(this,t,e,n)}C.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=N(t);if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(s&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||s&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var i,o,a=this.blocks,u=this.byteCount,c=t.length,h=this.blockCount,d=0,f=this.s;d>2]|=t[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(a[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=u){for(this.start=i-u,this.block=a[h],i=0;i>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},C.prototype.encodeString=function(t){var e,r=N(t);if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(s&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||s&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}var i=0,o=t.length;if(e)i=o;else for(var a=0;a=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(t),i},C.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e>4&15]+u[15&t]+u[t>>12&15]+u[t>>8&15]+u[t>>20&15]+u[t>>16&15]+u[t>>28&15]+u[t>>24&15];a%e==0&&(O(n),o=0)}return i&&(t=n[o],s+=u[t>>4&15]+u[15&t],i>1&&(s+=u[t>>12&15]+u[t>>8&15]),i>2&&(s+=u[t>>20&15]+u[t>>16&15])),s},C.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&O(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},D.prototype=new C,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var O=function(t){var e,n,r,i,o,a,s,u,c,l,d,f,p,y,m,g,v,w,b,M,A,N,I,E,x,k,T,L,S,j,C,D,O,z,P,_,B,R,U,Q,Y,W,F,V,H,G,q,Z,J,X,K,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(l<<1|d>>>31),n=s^(d<<1|l>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=l^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,y=t[0],m=t[1],G=t[11]<<4|t[10]>>>28,q=t[10]<<4|t[11]>>>28,L=t[20]<<3|t[21]>>>29,S=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,W=t[40]<<18|t[41]>>>14,F=t[41]<<18|t[40]>>>14,z=t[2]<<1|t[3]>>>31,P=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,Z=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,j=t[33]<<13|t[32]>>>19,C=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,_=t[14]<<6|t[15]>>>26,B=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,K=t[35]<<15|t[34]>>>17,D=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,E=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,R=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,H=t[9]<<27|t[8]>>>5,k=t[18]<<20|t[19]>>>12,T=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,Q=t[38]<<8|t[39]>>>24,Y=t[39]<<8|t[38]>>>24,N=t[48]<<14|t[49]>>>18,I=t[49]<<14|t[48]>>>18,t[0]=y^~g&w,t[1]=m^~v&b,t[10]=E^~k&L,t[11]=x^~T&S,t[20]=z^~_&R,t[21]=P^~B&U,t[30]=V^~G&Z,t[31]=H^~q&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=g^~w&M,t[3]=v^~b&A,t[12]=k^~L&j,t[13]=T^~S&C,t[22]=_^~R&Q,t[23]=B^~U&Y,t[32]=G^~Z&X,t[33]=q^~J&K,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=w^~M&N,t[5]=b^~A&I,t[14]=L^~j&D,t[15]=S^~C&O,t[24]=R^~Q&W,t[25]=U^~Y&F,t[34]=Z^~X&$,t[35]=J^~K&tt,t[44]=ot^~st&ct,t[45]=at^~ut<,t[6]=M^~N&y,t[7]=A^~I&m,t[16]=j^~D&E,t[17]=C^~O&x,t[26]=Q^~W&z,t[27]=Y^~F&P,t[36]=X^~$&V,t[37]=K^~tt&H,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=N^~y&g,t[9]=I^~m&v,t[18]=D^~E&k,t[19]=O^~x&T,t[28]=W^~z&_,t[29]=F^~P&B,t[38]=$^~V&G,t[39]=tt^~H&q,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=h[r],t[1]^=h[r+1]};if(a)e.exports=I;else for(x=0;xvt[n])&&console.log.apply(console,e)}},{key:"debug",value:function(){for(var e=arguments.length,n=new Array(e),r=0;r>4],n+=At[15&e[o]];i.push(t+"=Uint8Array(0x"+n+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push("code=".concat(n)),i.push("version=".concat(this.version));var o=e,a="";switch(n){case pt.NUMERIC_FAULT:a="NUMERIC_FAULT";var s=e;switch(s){case"overflow":case"underflow":case"division-by-zero":a+="-"+s;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result"}break;case pt.CALL_EXCEPTION:case pt.INSUFFICIENT_FUNDS:case pt.MISSING_NEW:case pt.NONCE_EXPIRED:case pt.REPLACEMENT_UNDERPRICED:case pt.TRANSACTION_REPLACED:case pt.UNPREDICTABLE_GAS_LIMIT:a=n}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),i.length&&(e+=" ("+i.join(", ")+")");var u=new Error(e);return u.reason=o,u.code=n,Object.keys(r).forEach((function(t){u[t]=r[t]})),u}},{key:"throwError",value:function(t,e,n){throw this.makeError(t,e,n)}},{key:"throwArgumentError",value:function(e,n,r){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:n,value:r})}},{key:"assert",value:function(t,e,n,r){t||this.throwError(e,n,r)}},{key:"assertArgument",value:function(t,e,n,r){t||this.throwArgumentError(e,n,r)}},{key:"checkNormalize",value:function(e){Mt&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Mt})}},{key:"checkSafeUint53",value:function(e,n){"number"==typeof e&&(null==n&&(n="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(n,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(n,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}},{key:"checkArgumentCount",value:function(e,n,r){r=r?": "+r:"",en&&this.throwError("too many arguments"+r,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:n})}},{key:"checkNew",value:function(e,n){(e===Object||null==e)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:n.name})}},{key:"checkAbstract",value:function(e,n){e===n?this.throwError("cannot instantiate abstract class "+JSON.stringify(n.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||null==e)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:n.name})}}],[{key:"globalLogger",value:function(){return bt||(bt=new t("logger/5.7.0")),bt}},{key:"setCensorship",value:function(e,n){if(!e&&n&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),mt){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}gt=!!e,mt=!!n}},{key:"setLogLevel",value:function(e){var n=vt[e.toLowerCase()];null!=n?wt=n:t.globalLogger().warn("invalid log level - "+e)}},{key:"from",value:function(e){return new t(e)}}])}();Nt.errors=pt,Nt.levels=ft;var It=new Nt("bytes/5.7.0");function Et(t){return!!t.toHexString}function xt(t){return t.slice||(t.slice=function(){var e=Array.prototype.slice.call(arguments);return xt(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function kt(t){return"number"==typeof t&&t==t&&t%1==0}function Tt(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t||!kt(t.length)||t.length<0)return!1;for(var e=0;e=256)return!1}return!0}function Lt(t,e){if(e||(e={}),"number"==typeof t){It.checkSafeUint53(t,"invalid arrayify value");for(var n=[];t;)n.unshift(255&t),t=parseInt(String(t/256));return 0===n.length&&n.push(0),xt(new Uint8Array(n))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Et(t)&&(t=t.toHexString()),St(t)){var r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":It.throwArgumentError("hex data is odd-length","value",t));for(var i=[],o=0;o>4]+jt[15&o]}return r}return It.throwArgumentError("invalid hexlify value","value",t)}function Dt(t,e,n){return"string"!=typeof t?t=Ct(t):(!St(t)||t.length%2)&&It.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=n?"0x"+t.substring(e,2+2*n):"0x"+t.substring(e)}function Ot(t,e){for("string"!=typeof t?t=Ct(t):St(t)||It.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&It.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function zt(t){var e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(function(t){return St(t)&&!(t.length%2)||Tt(t)}(t)){var n=Lt(t);64===n.length?(e.v=27+(n[32]>>7),n[32]&=127,e.r=Ct(n.slice(0,32)),e.s=Ct(n.slice(32,64))):65===n.length?(e.r=Ct(n.slice(0,32)),e.s=Ct(n.slice(32,64)),e.v=n[64]):It.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:It.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(n[32]|=128),e._vs=Ct(n.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){var r=function(t,e){(t=Lt(t)).length>e&&It.throwArgumentError("value out of range","value",arguments[0]);var n=new Uint8Array(e);return n.set(t,e-t.length),xt(n)}(Lt(e._vs),32);e._vs=Ct(r);var i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&It.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;var o=Ct(r);null==e.s?e.s=o:e.s!==o&&It.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?It.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{var a=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==a&&It.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&St(e.r)?e.r=Ot(e.r,32):It.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&St(e.s)?e.s=Ot(e.s,32):It.throwArgumentError("signature missing or invalid s","signature",t);var s=Lt(e.s);s[0]>=128&&It.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(s[0]|=128);var u=Ct(s);e._vs&&(St(e._vs)||It.throwArgumentError("signature invalid _vs","signature",t),e._vs=Ot(e._vs,32)),null==e._vs?e._vs=u:e._vs!==u&&It.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Pt(t){return"0x"+yt.keccak_256(Lt(t))}var _t={exports:{}},Bt=function(t){var e=t.default;if("function"==typeof e){var n=function(){return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}(Object.freeze({__proto__:null,default:{}}));!function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(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 o;"object"==N(t)?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o=("undefined"==typeof window?"undefined":N(window))<"u"&&N(window.Buffer)<"u"?window.Buffer:Bt.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==N(t))return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=2)i=s(t,e,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l1&&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},("undefined"==typeof Symbol?"undefined":N(Symbol))<"u"&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var h=["","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"],d=[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],f=[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 p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}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 r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},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 8191&e||(n+=13,e>>>=13),127&e||(n+=7,e>>>=7),15&e||(n+=4,e>>>=4),3&e||(n+=2,e>>>=2),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;et.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;nt.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;rt.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){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;ot.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,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],N=8191&A,I=A>>>13,E=0|a[5],x=8191&E,k=E>>>13,T=0|a[6],L=8191&T,S=T>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,Y=U>>>13,W=0|s[1],F=8191&W,V=W>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191<,dt=lt>>>13,ft=0|s[9],pt=8191&ft,yt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,Y))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,Y))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,Y))+Math.imul(y,Q)|0,o=Math.imul(y,Y);var gt=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,Y))+Math.imul(v,Q)|0,o=Math.imul(v,Y),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var vt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,Y))+Math.imul(M,Q)|0,o=Math.imul(M,Y),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(N,Q),i=(i=Math.imul(N,Y))+Math.imul(I,Q)|0,o=Math.imul(I,Y),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,Q),i=(i=Math.imul(x,Y))+Math.imul(k,Q)|0,o=Math.imul(k,Y),r=r+Math.imul(N,F)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,Y))+Math.imul(S,Q)|0,o=Math.imul(S,Y),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(y,nt)|0,o=o+Math.imul(y,rt)|0;var At=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(C,Q),i=(i=Math.imul(C,Y))+Math.imul(D,Q)|0,o=Math.imul(D,Y),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,nt)|0,i=(i=i+Math.imul(g,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0;var Nt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,Y))+Math.imul(P,Q)|0,o=Math.imul(P,Y),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0;var It=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,Y))+Math.imul(R,Q)|0,o=Math.imul(R,Y),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(N,nt)|0,i=(i=i+Math.imul(N,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,yt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,yt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(g,ht)|0,i=(i=i+Math.imul(g,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(L,nt)|0,i=(i=i+Math.imul(L,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var kt=(c+(r=r+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,tt)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(N,ht)|0,i=(i=i+Math.imul(N,dt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,dt)|0;var Tt=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,yt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(z,nt)|0,i=(i=i+Math.imul(z,rt)|0)+Math.imul(P,nt)|0,o=o+Math.imul(P,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var Lt=(c+(r=r+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,yt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,yt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(z,ot)|0,i=(i=i+Math.imul(z,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,dt)|0;var St=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,yt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,yt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(z,ut)|0,i=(i=i+Math.imul(z,ct)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var jt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,yt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,yt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(z,ht)|0,i=(i=i+Math.imul(z,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Ct=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,yt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,yt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(z,pt)|0)|0)+((8191&(i=(i=i+Math.imul(z,yt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((o=o+Math.imul(P,yt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,yt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,yt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=mt,u[1]=gt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=At,u[7]=Nt,u[8]=It,u[9]=Et,u[10]=xt,u[11]=kt,u[12]=Tt,u[13]=Lt,u[14]=St,u[15]=jt,u[16]=Ct,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(t,e,n){return m(t,e,n)}Math.imul||(y=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?y(this,t,e):n<63?p(this,t,e):n<1024?m(this,t,e):g(this,t,e)},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),g(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():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>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}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,r){return n(0===this.negative),this.iushrn(t,e,r)},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){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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(n("number"==typeof t),n(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>26)-(u/67108864|0),this.words[i+r]=67108863&a}for(;i>26,this.words[i+r]=67108863&a;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):this.negative&t.negative?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):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.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},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),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;!(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;!(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e,r=this,o=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var a=new i(1),s=new i(0),u=o.clone();r.cmpn(1)>0&&o.cmpn(1)>0;){for(var c=0,l=1;!(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;!(o.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(o.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);r.cmp(o)>=0?(r.isub(o),a.isub(s)):(o.isub(r),s.isub(a))}return(e=0===r.cmpn(1)?a:s).cmpn(0)<0&&e.iadd(t),e},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 i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||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){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){ri&&(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 E(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function x(t){E.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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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=e0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new I}return v[t]=e,e},E.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.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)},E.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},E.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)},E.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.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),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m=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!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new x(t)},r(x,E),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.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),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.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),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,ht)}(_t);var Rt=_t.exports,Ut="bignumber/5.7.0",Qt=Rt.BN,Yt=new Nt(Ut),Wt={},Ft=9007199254740991,Vt=!1,Ht=function(){function t(e,n){v(this,t),e!==Wt&&Yt.throwError("cannot call constructor directly; use BigNumber.from",Nt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=n,this._isBigNumber=!0,Object.freeze(this)}return b(t,[{key:"fromTwos",value:function(t){return qt(Zt(this).fromTwos(t))}},{key:"toTwos",value:function(t){return qt(Zt(this).toTwos(t))}},{key:"abs",value:function(){return"-"===this._hex[0]?t.from(this._hex.substring(1)):this}},{key:"add",value:function(t){return qt(Zt(this).add(Zt(t)))}},{key:"sub",value:function(t){return qt(Zt(this).sub(Zt(t)))}},{key:"div",value:function(e){return t.from(e).isZero()&&Jt("division-by-zero","div"),qt(Zt(this).div(Zt(e)))}},{key:"mul",value:function(t){return qt(Zt(this).mul(Zt(t)))}},{key:"mod",value:function(t){var e=Zt(t);return e.isNeg()&&Jt("division-by-zero","mod"),qt(Zt(this).umod(e))}},{key:"pow",value:function(t){var e=Zt(t);return e.isNeg()&&Jt("negative-power","pow"),qt(Zt(this).pow(e))}},{key:"and",value:function(t){var e=Zt(t);return(this.isNegative()||e.isNeg())&&Jt("unbound-bitwise-result","and"),qt(Zt(this).and(e))}},{key:"or",value:function(t){var e=Zt(t);return(this.isNegative()||e.isNeg())&&Jt("unbound-bitwise-result","or"),qt(Zt(this).or(e))}},{key:"xor",value:function(t){var e=Zt(t);return(this.isNegative()||e.isNeg())&&Jt("unbound-bitwise-result","xor"),qt(Zt(this).xor(e))}},{key:"mask",value:function(t){return(this.isNegative()||t<0)&&Jt("negative-width","mask"),qt(Zt(this).maskn(t))}},{key:"shl",value:function(t){return(this.isNegative()||t<0)&&Jt("negative-width","shl"),qt(Zt(this).shln(t))}},{key:"shr",value:function(t){return(this.isNegative()||t<0)&&Jt("negative-width","shr"),qt(Zt(this).shrn(t))}},{key:"eq",value:function(t){return Zt(this).eq(Zt(t))}},{key:"lt",value:function(t){return Zt(this).lt(Zt(t))}},{key:"lte",value:function(t){return Zt(this).lte(Zt(t))}},{key:"gt",value:function(t){return Zt(this).gt(Zt(t))}},{key:"gte",value:function(t){return Zt(this).gte(Zt(t))}},{key:"isNegative",value:function(){return"-"===this._hex[0]}},{key:"isZero",value:function(){return Zt(this).isZero()}},{key:"toNumber",value:function(){try{return Zt(this).toNumber()}catch(t){Jt("overflow","toNumber",this.toString())}return null}},{key:"toBigInt",value:function(){try{return BigInt(this.toString())}catch(t){}return Yt.throwError("this platform does not support BigInt",Nt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}},{key:"toString",value:function(){return arguments.length>0&&(10===arguments[0]?Vt||(Vt=!0,Yt.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Yt.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Nt.errors.UNEXPECTED_ARGUMENT,{}):Yt.throwError("BigNumber.toString does not accept parameters",Nt.errors.UNEXPECTED_ARGUMENT,{})),Zt(this).toString(10)}},{key:"toHexString",value:function(){return this._hex}},{key:"toJSON",value:function(t){return{type:"BigNumber",hex:this.toHexString()}}}],[{key:"from",value:function(e){if(e instanceof t)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new t(Wt,Gt(e)):e.match(/^-?[0-9]+$/)?new t(Wt,Gt(new Qt(e))):Yt.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Jt("underflow","BigNumber.from",e),(e>=Ft||e<=-Ft)&&Jt("overflow","BigNumber.from",e),t.from(String(e));var n=e;if("bigint"==typeof n)return t.from(n.toString());if(Tt(n))return t.from(Ct(n));if(n)if(n.toHexString){var r=n.toHexString();if("string"==typeof r)return t.from(r)}else{var i=n._hex;if(null==i&&"BigNumber"===n.type&&(i=n.hex),"string"==typeof i&&(St(i)||"-"===i[0]&&St(i.substring(1))))return t.from(i)}return Yt.throwArgumentError("invalid BigNumber value","value",e)}},{key:"isBigNumber",value:function(t){return!(!t||!t._isBigNumber)}}])}();function Gt(t){if("string"!=typeof t)return Gt(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Yt.throwArgumentError("invalid hex","value",t),"0x00"===(t=Gt(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function qt(t){return Ht.from(Gt(t))}function Zt(t){var e=Ht.from(t).toHexString();return"-"===e[0]?new Qt("-"+e.substring(3),16):new Qt(e.substring(2),16)}function Jt(t,e,n){var r={fault:t,operation:e};return null!=n&&(r.value=n),Yt.throwError(t,Nt.errors.NUMERIC_FAULT,r)}var Xt=new Nt(Ut),Kt={},$t=Ht.from(0),te=Ht.from(-1);function ee(t,e,n,r){var i={fault:e,operation:n};return void 0!==r&&(i.value=r),Xt.throwError(t,Nt.errors.NUMERIC_FAULT,i)}for(var ne="0";ne.length<256;)ne+=ne;function re(t){if("number"!=typeof t)try{t=Ht.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+ne.substring(0,t):Xt.throwArgumentError("invalid decimal size","decimals",t)}function ie(t,e){null==e&&(e=0);var n=re(e),r=(t=Ht.from(t)).lt($t);r&&(t=t.mul(te));for(var i=t.mod(n).toString();i.length2&&Xt.throwArgumentError("too many decimal points","value",t);var o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>n.length-1&&ee("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length80&&Xt.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new t(Kt,n,r,i)}}])}(),ce=function(){function t(e,n,r,i){v(this,t),e!==Kt&&Xt.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Nt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=n,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}return b(t,[{key:"_checkFormat",value:function(t){this.format.name!==t.format.name&&Xt.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}},{key:"addUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.add(r),this.format.decimals,this.format)}},{key:"subUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.sub(r),this.format.decimals,this.format)}},{key:"mulUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}},{key:"divUnsafe",value:function(e){this._checkFormat(e);var n=oe(this._value,this.format.decimals),r=oe(e._value,e.format.decimals);return t.fromValue(n.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}},{key:"floor",value:function(){var e=this.toString().split(".");1===e.length&&e.push("0");var n=t.from(e[0],this.format),r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(n=n.subUnsafe(le.toFormat(n.format))),n}},{key:"ceiling",value:function(){var e=this.toString().split(".");1===e.length&&e.push("0");var n=t.from(e[0],this.format),r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(n=n.addUnsafe(le.toFormat(n.format))),n}},{key:"round",value:function(e){null==e&&(e=0);var n=this.toString().split(".");if(1===n.length&&n.push("0"),(e<0||e>80||e%1)&&Xt.throwArgumentError("invalid decimal count","decimals",e),n[1].length<=e)return this;var r=t.from("1"+ne.substring(0,e),this.format),i=he.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(i).floor().divUnsafe(r)}},{key:"isZero",value:function(){return"0.0"===this._value||"0"===this._value}},{key:"isNegative",value:function(){return"-"===this._value[0]}},{key:"toString",value:function(){return this._value}},{key:"toHexString",value:function(t){return null==t?this._hex:(t%8&&Xt.throwArgumentError("invalid byte width","width",t),Ot(Ht.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8))}},{key:"toUnsafeFloat",value:function(){return parseFloat(this.toString())}},{key:"toFormat",value:function(e){return t.fromString(this._value,e)}}],[{key:"fromValue",value:function(e,n,r){return null==r&&null!=n&&!function(t){return null!=t&&(Ht.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||St(t)||"bigint"==typeof t||Tt(t))}(n)&&(r=n,n=null),null==n&&(n=0),null==r&&(r="fixed"),t.fromString(ie(e,n),ue.from(r))}},{key:"fromString",value:function(e,n){null==n&&(n="fixed");var r=ue.from(n),i=oe(e,r.decimals);!r.signed&&i.lt($t)&&ee("unsigned value cannot be negative","overflow","value",e);var o=null;o=r.signed?i.toTwos(r.width).toHexString():Ot(o=i.toHexString(),r.width/8);var a=ie(i,r.decimals);return new t(Kt,o,a,r)}},{key:"fromBytes",value:function(e,n){null==n&&(n="fixed");var r=ue.from(n);if(Lt(e).length>r.width/8)throw new Error("overflow");var i=Ht.from(e);r.signed&&(i=i.fromTwos(r.width));var o=i.toTwos((r.signed?0:1)+r.width).toHexString(),a=ie(i,r.decimals);return new t(Kt,o,a,r)}},{key:"from",value:function(e,n){if("string"==typeof e)return t.fromString(e,n);if(Tt(e))return t.fromBytes(e,n);try{return t.fromValue(e,0,n)}catch(t){if(t.code!==Nt.errors.INVALID_ARGUMENT)throw t}return Xt.throwArgumentError("invalid FixedNumber value","value",e)}},{key:"isFixedNumber",value:function(t){return!(!t||!t._isFixedNumber)}}])}(),le=ce.from(1),he=ce.from("0.5"),de=new Nt("strings/5.7.0");function fe(t,e,n,r,i){if(t===se.BAD_PREFIX||t===se.UNEXPECTED_CONTINUE){for(var o=0,a=e+1;a>6==2;a++)o++;return o}return t===se.OVERRUN?n.length-e-1:0}function pe(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ae.current;e!=ae.current&&(de.checkNormalize(),t=t.normalize(e));for(var n=[],r=0;r>6|192),n.push(63&i|128);else if(55296==(64512&i)){r++;var o=t.charCodeAt(r);if(r>=t.length||56320!=(64512&o))throw new Error("invalid utf-8 string");var a=65536+((1023&i)<<10)+(1023&o);n.push(a>>18|240),n.push(a>>12&63|128),n.push(a>>6&63|128),n.push(63&a|128)}else n.push(i>>12|224),n.push(i>>6&63|128),n.push(63&i|128)}return Lt(n)}function ye(t,e){e||(e=function(t){return[parseInt(t,16)]});var n=0,r={};return t.split(",").forEach((function(t){var i=t.split(":");n+=parseInt(i[0],16),r[n]=e(i[1])})),r}function me(t){var e=0;return t.split(",").map((function(t){var n=t.split("-");return 1===n.length?n[1]="0":""===n[1]&&(n[1]="1"),{l:e+parseInt(n[0],16),h:e=parseInt(n[1],16)}}))}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(ae||(ae={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(se||(se={})),Object.freeze({error:function(t,e,n,r,i){return de.throwArgumentError("invalid codepoint at offset ".concat(e,"; ").concat(t),"bytes",n)},ignore:fe,replace:function(t,e,n,r,i){return t===se.OVERLONG?(r.push(i),0):(r.push(65533),fe(t,e,n))}}),me("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((function(t){return parseInt(t,16)})),ye("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),ye("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),ye("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");for(var e=[],n=0;n0&&Array.isArray(e)?t(e,i-1):n.push(e)}))}(t,e),n}function we(t){return 1&t?~t>>1:t>>1}function be(t,e){for(var n=Array(t),r=0,i=-1;r>--c&1}for(var d=Math.pow(2,31),f=d>>>1,p=f>>1,y=d-1,m=0,g=0;g<31;g++)m=m<<1|h();for(var v=[],w=0,b=d;;){for(var M=Math.floor(((m-w+1)*i-1)/b),A=0,N=r;N-A>1;){var I=A+N>>>1;M>>1|h(),E=E<<1^f,x=(x^f)<<1|f|1;w=E,b=1+x-E}var k=r-4;return v.map((function(e){switch(e-k){case 3:return k+65792+(t[u++]<<16|t[u++]<<8|t[u++]);case 2:return k+256+(t[u++]<<8|t[u++]);case 1:return k+t[u++];default:return e-1}}))}(t))}(function(t){t=atob(t);for(var e=[],n=0;n>=1),check:2==o}}()}(xe),new Nt(ge),new Uint8Array(32).fill(0),new Nt("rlp/5.7.0");var Te=new Nt("address/5.7.0");function Le(t){St(t,20)||Te.throwArgumentError("invalid address","address",t);for(var e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40),r=0;r<40;r++)n[r]=e[r].charCodeAt(0);for(var i=Lt(Pt(n)),o=0;o<40;o+=2)i[o>>1]>>4>=8&&(e[o]=e[o].toUpperCase()),(15&i[o>>1])>=8&&(e[o+1]=e[o+1].toUpperCase());return"0x"+e.join("")}for(var Se={},je=0;je<10;je++)Se[String(je)]=String(je);for(var Ce=0;Ce<26;Ce++)Se[String.fromCharCode(65+Ce)]=String(10+Ce);var De=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Oe(t,e,n){Object.defineProperty(t,e,{enumerable:!0,value:n,writable:!1})}new Nt("properties/5.7.0"),new Nt(ge),new Uint8Array(32).fill(0),Ht.from(-1);var ze=Ht.from(0),Pe=Ht.from(1);Ht.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Ot(Pe.toHexString(),32),Ot(ze.toHexString(),32);var _e={},Be={},Re=Ue;function Ue(t,e){if(!t)throw new Error(e||"Assertion failed")}Ue.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var Qe={exports:{}};"function"==typeof Object.create?Qe.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Qe.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}};var Ye=Re,We=Qe.exports;function Fe(t,e){return!(55296!=(64512&t.charCodeAt(e))||e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function Ve(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function He(t){return 1===t.length?"0"+t:t}function Ge(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}Be.inherits=We,Be.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,n[r++]=63&o|128):Fe(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i>>0}return o},Be.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},Be.rotr32=function(t,e){return t>>>e|t<<32-e},Be.rotl32=function(t,e){return t<>>32-e},Be.sum32=function(t,e){return t+e>>>0},Be.sum32_3=function(t,e,n){return t+e+n>>>0},Be.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},Be.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},Be.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o>>0,t[e+1]=o},Be.sum64_hi=function(t,e,n,r){return(e+r>>>0>>0},Be.sum64_lo=function(t,e,n,r){return e+r>>>0},Be.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)>>0)>>0)>>0},Be.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},Be.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)>>0)>>0)>>0)>>0},Be.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},Be.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},Be.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},Be.shr64_hi=function(t,e,n){return t>>>n},Be.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var qe={},Ze=Be,Je=Re;function Xe(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}qe.BlockHash=Xe,Xe.prototype.update=function(t,e){if(t=Ze.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=Ze.join32(t,0,t.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},$e.g1_256=function(t){return tn(t,17)^tn(t,19)^t>>>10};var on=Be,an=qe,sn=$e,un=on.rotl32,cn=on.sum32,ln=on.sum32_5,hn=sn.ft_1,dn=an.BlockHash,fn=[1518500249,1859775393,2400959708,3395469782];function pn(){if(!(this instanceof pn))return new pn;dn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}on.inherits(pn,dn);var yn=pn;pn.blockSize=512,pn.outSize=160,pn.hmacStrength=80,pn.padLength=64,pn.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;rthis.blockSize&&(t=(new this.Hash).update(t).digest()),Or(t.length<=this.blockSize);for(var e=t.length;e>8,a=255&i;o?n.push(o,a):n.push(a)}return n},n.zero2=r,n.toHex=i,n.encode=function(t,e){return"hex"===e?i(t):t}})),Qr=_r((function(t,e){var n=e;n.assert=Br,n.toArray=Ur.toArray,n.zero2=Ur.zero2,n.toHex=Ur.toHex,n.encode=Ur.encode,n.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},n.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=1&u?3!=(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u:0,n[0].push(a),s=1&c?3!=(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c:0,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},n.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new Rt(t,"hex","le")}})),Yr=Qr.getNAF,Wr=Qr.getJSF,Fr=Qr.assert;function Vr(t,e){this.type=t,this.p=new Rt(e.p,16),this.red=e.prime?Rt.red(e.prime):Rt.mont(this.p),this.zero=new Rt(0).toRed(this.red),this.one=new Rt(1).toRed(this.red),this.two=new Rt(2).toRed(this.red),this.n=e.n&&new Rt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hr=Vr;function Gr(t,e){this.curve=t,this.type=e,this.precomputed=null}Vr.prototype.point=function(){throw new Error("Not implemented")},Vr.prototype.validate=function(){throw new Error("Not implemented")},Vr.prototype._fixedNafMul=function(t,e){Fr(t.precomputed);var n=t._getDoubles(),r=Yr(e,1,this._bitLength),i=(1<=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];Fr(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},Vr.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var y=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(y[1]=e[f].add(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].add(e[p].neg())):(y[1]=e[f].toJ().mixedAdd(e[p]),y[2]=e[f].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=Wr(n[f],n[p]);for(h=Math.max(g[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a=0;o--){for(var A=0;o>=0;){var N=!0;for(a=0;a=0&&A++,b=b.dblp(A),o<0)break;for(a=0;a0?s=c[a][I-1>>1]:I<0&&(s=c[a][-I-1>>1].neg()),b="affine"===s.type?b.mixedAdd(s):b.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},Gr.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},Jr.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},Jr.prototype.pointFromX=function(t,e){(t=new Rt(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},Jr.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Jr.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},Kr.prototype.isInfinity=function(){return this.inf},Kr.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},Kr.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Kr.prototype.getX=function(){return this.x.fromRed()},Kr.prototype.getY=function(){return this.y.fromRed()},Kr.prototype.mul=function(t){return t=new Rt(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Kr.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},Kr.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},Kr.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Kr.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},Kr.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},qr($r,Hr.BasePoint),Jr.prototype.jpoint=function(t,e,n){return new $r(this,t,e,n)},$r.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},$r.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$r.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},$r.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},$r.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},$r.prototype.inspect=function(){return this.isInfinity()?"":""},$r.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var ti=_r((function(t,e){var n=e;n.base=Hr,n.short=Xr,n.mont=null,n.edwards=null})),ei=_r((function(t,e){var n,r=e,i=Qr.assert;function o(t){"short"===t.type?this.curve=new ti.short(t):"edwards"===t.type?this.curve=new ti.edwards(t):this.curve=new ti.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new o(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:_e.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:_e.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:_e.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:_e.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:_e.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_e.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_e.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(t){n=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:_e.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function ni(t){if(!(this instanceof ni))return new ni(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Ur.toArray(t.entropy,t.entropyEnc||"hex"),n=Ur.toArray(t.nonce,t.nonceEnc||"hex"),r=Ur.toArray(t.pers,t.persEnc||"hex");Br(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var ri=ni;ni.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},ni.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=Ur.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var si=Qr.assert;function ui(t,e){if(t instanceof ui)return t;this._importDER(t,e)||(si(t.r&&t.s,"Signature without r or s"),this.r=new Rt(t.r,16),this.s=new Rt(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var ci=ui;function li(){this.place=0}function hi(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o>>=0;return!(i<=127)&&(e.place=a,i)}function di(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}ui.prototype._importDER=function(t,e){t=Qr.toArray(t,e);var n=new li;if(48!==t[n.place++])return!1;var r=hi(t,n);if(!1===r||r+n.place!==t.length||2!==t[n.place++])return!1;var i=hi(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=hi(t,n);if(!1===a||t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new Rt(o),this.s=new Rt(s),this.recoveryParam=null,!0},ui.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=di(e),n=di(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];fi(r,e.length),(r=r.concat(e)).push(2),fi(r,n.length);var i=r.concat(n),o=[48];return fi(o,i.length),o=o.concat(i),Qr.encode(o,t)};var pi=function(){throw new Error("unsupported")},yi=Qr.assert;function mi(t){if(!(this instanceof mi))return new mi(t);"string"==typeof t&&(yi(Object.prototype.hasOwnProperty.call(ei,t),"Unknown curve "+t),t=ei[t]),t instanceof ei.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var gi=mi;mi.prototype.keyPair=function(t){return new ai(this,t)},mi.prototype.keyFromPrivate=function(t,e){return ai.fromPrivate(this,t,e)},mi.prototype.keyFromPublic=function(t,e){return ai.fromPublic(this,t,e)},mi.prototype.genKeyPair=function(t){t||(t={});for(var e=new ri({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||pi(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new Rt(2));;){var i=new Rt(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},mi.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},mi.prototype.sign=function(t,e,n,r){"object"==N(n)&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new Rt(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new ri({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new Rt(1)),c=0;;c++){var l=r.k?r.k(c):new Rt(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new ci({r:f,s:p,recoveryParam:y})}}}}}},mi.prototype.verify=function(t,e,n,r){t=this._truncateToN(new Rt(t,16)),n=this.keyFromPublic(n,r);var i=(e=new ci(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},mi.prototype.recoverPubKey=function(t,e,n,r){yi((3&n)===n,"The recovery param is more than two bits"),e=new ci(e,r);var i=this.n,o=new Rt(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},mi.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new ci(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var vi=_r((function(t,e){var n=e;n.version="6.5.4",n.utils=Qr,n.rand=function(){throw new Error("unsupported")},n.curve=ti,n.curves=ei,n.ec=gi,n.eddsa=null})).ec,wi=new Nt("signing-key/5.7.0"),bi=null;function Mi(){return bi||(bi=new vi("secp256k1")),bi}var Ai,Ni=b((function t(e){v(this,t),Oe(this,"curve","secp256k1"),Oe(this,"privateKey",Ct(e)),32!==function(t){if("string"!=typeof t)t=Ct(t);else if(!St(t)||t.length%2)return null;return(t.length-2)/2}(this.privateKey)&&wi.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");var n=Mi().keyFromPrivate(Lt(this.privateKey));Oe(this,"publicKey","0x"+n.getPublic(!1,"hex")),Oe(this,"compressedPublicKey","0x"+n.getPublic(!0,"hex")),Oe(this,"_isSigningKey",!0)}),[{key:"_addPoint",value:function(t){var e=Mi().keyFromPublic(Lt(this.publicKey)),n=Mi().keyFromPublic(Lt(t));return"0x"+e.pub.add(n.pub).encodeCompressed("hex")}},{key:"signDigest",value:function(t){var e=Mi().keyFromPrivate(Lt(this.privateKey)),n=Lt(t);32!==n.length&&wi.throwArgumentError("bad digest length","digest",t);var r=e.sign(n,{canonical:!0});return zt({recoveryParam:r.recoveryParam,r:Ot("0x"+r.r.toString(16),32),s:Ot("0x"+r.s.toString(16),32)})}},{key:"computeSharedSecret",value:function(t){var e=Mi().keyFromPrivate(Lt(this.privateKey)),n=Mi().keyFromPublic(Lt(Ii(t)));return Ot("0x"+e.derive(n.getPublic()).toString(16),32)}}],[{key:"isSigningKey",value:function(t){return!(!t||!t._isSigningKey)}}]);function Ii(t,e){var n=Lt(t);if(32===n.length){var r=new Ni(n);return e?"0x"+Mi().keyFromPrivate(n).getPublic(!0,"hex"):r.publicKey}return 33===n.length?e?Ct(n):"0x"+Mi().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?e?"0x"+Mi().keyFromPublic(n).getPublic(!0,"hex"):Ct(n):wi.throwArgumentError("invalid public or private key","key","[REDACTED]")}function Ei(t,e){return function(t){return function(t){var e=null;if("string"!=typeof t&&Te.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Le(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Te.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){for(var e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((function(t){return Se[t]})).join("");e.length>=De;){var n=e.substring(0,De);e=parseInt(n,10)%97+e.substring(n.length)}for(var r=String(98-parseInt(e,10)%97);r.length<2;)r="0"+r;return r}(t)&&Te.throwArgumentError("bad icap checksum","address",t),e=function(t){return new Qt(t,36).toString(16)}(t.substring(4));e.length<40;)e="0"+e;e=Le("0x"+e)}else Te.throwArgumentError("invalid address","address",t);return e}(Dt(Pt(Dt(Ii(t),1)),12))}(function(t,e){var n=zt(e),r={r:Lt(n.r),s:Lt(n.s)};return"0x"+Mi().recoverPubKey(Lt(t),r,n.recoveryParam).encode("hex",!1)}(Lt(t),e))}function xi(t,e,n,r,i,o){return L(this,null,A().mark((function a(){return A().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:a.t0=n.t,a.next="eip191"===a.t0?3:"eip1271"===a.t0?4:7;break;case 3:return a.abrupt("return",ki(t,e,n.s));case 4:return a.next=6,Ti(t,e,n.s,r,i,o);case 6:return a.abrupt("return",a.sent);case 7:throw new Error("verifySignature failed: Attempted to verify CacaoSignature with unknown type: ".concat(n.t));case 8:case"end":return a.stop()}}),a)})))}function ki(t,e,n){return Ei(ke(e),n).toLowerCase()===t.toLowerCase()}function Ti(t,e,n,r,i,o){return L(this,null,A().mark((function a(){var s,u,c,l,h,d,f;return A().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,s="0x1626ba7e",u=n.substring(2),c=ke(e).substring(2),l=s+c+"00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041"+u,a.next=9,fetch("".concat(o||"https://rpc.walletconnect.com/v1","/?chainId=").concat(r,"&projectId=").concat(i),{method:"POST",body:JSON.stringify({id:Date.now()+Math.floor(1e3*Math.random()),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:l},"latest"]})});case 9:return h=a.sent,a.next=12,h.json();case 12:return d=a.sent,f=d.result,a.abrupt("return",!!f&&f.slice(0,s.length).toLowerCase()===s.toLowerCase());case 17:return a.prev=17,a.t0=a.catch(0),a.abrupt("return",(console.error("isValidEip1271Signature: ",a.t0),!1));case 20:case"end":return a.stop()}}),a,null,[[0,17]])})))}new Nt("transactions/5.7.0"),function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(Ai||(Ai={}));var Li=Object.defineProperty,Si=Object.defineProperties,ji=Object.getOwnPropertyDescriptors,Ci=Object.getOwnPropertySymbols,Di=Object.prototype.hasOwnProperty,Oi=Object.prototype.propertyIsEnumerable,zi=function(t,e,n){return e in t?Li(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},Pi=function(t){return null==t?void 0:t.split(":")},_i=function(t){var e=t&&Pi(t);if(e)return t.includes("did:pkh:")?e[3]:e[1]},Bi=function(t){var e=t&&Pi(t);if(e)return e[2]+":"+e[3]},Ri=function(t){var e=t&&Pi(t);if(e)return e.pop()};function Ui(t){return L(this,null,A().mark((function e(){var n,r,i,o,a,s;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.cacao,r=t.projectId,i=n.s,o=n.p,a=Qi(o,o.iss),s=Ri(o.iss),e.next=3,xi(s,a,i,_i(o.iss),r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))}var Qi=function(t,e){var n="".concat(t.domain," wants you to sign in with your Ethereum account:"),r=Ri(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");var i=t.statement||void 0,o="URI: ".concat(t.aud||t.uri),a="Version: ".concat(t.version),s="Chain ID: ".concat(_i(e)),u="Nonce: ".concat(t.nonce),c="Issued At: ".concat(t.iat),l=t.resources?"Resources:".concat(t.resources.map((function(t){return"\n- ".concat(t)})).join("")):void 0,h=Ji(t.resources);return h&&(i=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0;Yi(e);var n="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(n))return t;var r=[],i=0;Object.keys(e.att).forEach((function(t){var n=Object.keys(e.att[t]).map((function(t){return{ability:t.split("/")[0],action:t.split("/")[1]}}));n.sort((function(t,e){return t.action.localeCompare(e.action)}));var o={};n.forEach((function(t){o[t.ability]||(o[t.ability]=[]),o[t.ability].push(t.action)}));var a=Object.keys(o).map((function(e){return i++,"(".concat(i,") '").concat(e,"': '").concat(o[e].join("', '"),"' for '").concat(t,"'.")}));r.push(a.join(", ").replace(".,","."))}));var o=r.join(" "),a="".concat(n).concat(o);return"".concat(t?t+" ":"").concat(a)}(i,Vi(h))),[n,r,"",i,"",o,a,s,u,c,l].filter((function(t){return null!=t})).join("\n")};function Yi(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");var e=Object.keys(t.att);if(null==e||!e.length)throw new Error("No resources found in `att` property");e.forEach((function(e){var n=t.att[e];if(Array.isArray(n))throw new Error("Resource must be an object: ".concat(e));if("object"!=N(n))throw new Error("Resource must be an object: ".concat(e));if(!Object.keys(n).length)throw new Error("Resource object is empty: ".concat(e));Object.keys(n).forEach((function(t){var e=n[t];if(!Array.isArray(e))throw new Error("Ability limits ".concat(t," must be an array of objects, found: ").concat(e));if(!e.length)throw new Error("Value of ".concat(t," is empty array, must be an array with objects"));e.forEach((function(e){if("object"!=N(e))throw new Error("Ability limits (".concat(t,") must be an array of objects, found: ").concat(e))}))}))}))}function Wi(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(e=null==e?void 0:e.sort((function(t,e){return t.localeCompare(e)}))).map((function(e){return g({},"".concat(t,"/").concat(e),[n])}));return Object.assign.apply(Object,[{}].concat(E(r)))}function Fi(t){return Yi(t),"urn:recap:".concat(function(t){return i.from(JSON.stringify(t)).toString("base64")}(t).replace(/=/g,""))}function Vi(t){var e=function(t){return JSON.parse(i.from(t,"base64").toString("utf-8"))}(t.replace("urn:recap:",""));return Yi(e),e}function Hi(t,e,n){return Fi(function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return null==n||n.sort((function(t,e){return t.localeCompare(e)})),{att:g({},t,Wi(e,n,r))}}(t,e,n))}function Gi(t,e){return Fi(function(t,e){Yi(t),Yi(e);var n=Object.keys(t.att).concat(Object.keys(e.att)).sort((function(t,e){return t.localeCompare(e)})),r={att:{}};return n.forEach((function(n){var i,o;Object.keys((null==(i=t.att)?void 0:i[n])||{}).concat(Object.keys((null==(o=e.att)?void 0:o[n])||{})).sort((function(t,e){return t.localeCompare(e)})).forEach((function(i){var o,a;r.att[n]=function(t,e){return Si(t,ji(e))}(function(t,e){for(var n in e||(e={}))Di.call(e,n)&&zi(t,n,e[n]);if(Ci){var r,i=I(Ci(e));try{for(i.s();!(r=i.n()).done;)n=r.value,Oi.call(e,n)&&zi(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t}({},r.att[n]),g({},i,(null==(o=t.att[n])?void 0:o[i])||(null==(a=e.att[n])?void 0:a[i])))}))})),r}(Vi(t),Vi(e)))}function qi(t){var e,n=Vi(t);Yi(n);var r=null==(e=n.att)?void 0:e.eip155;return r?Object.keys(r).map((function(t){return t.split("/")[1]})):[]}function Zi(t){var e=Vi(t);Yi(e);var n=[];return Object.values(e.att).forEach((function(t){Object.values(t).forEach((function(t){var e;null!=(e=null==t?void 0:t[0])&&e.chains&&n.push(t[0].chains)}))})),E(new Set(n.flat()))}function Ji(t){if(t){var e=null==t?void 0:t[t.length-1];return function(t){return t&&t.includes("urn:recap:")}(e)?e:void 0}}var Xi="base16",Ki="base64pad",$i="utf8",to=1;function eo(){var t=p.generateKeyPair();return{privateKey:Object(y.toString)(t.secretKey,Xi),publicKey:Object(y.toString)(t.publicKey,Xi)}}function no(){var t=Object(d.randomBytes)(32);return Object(y.toString)(t,Xi)}function ro(t,e){var n=p.sharedKey(Object(y.fromString)(t,Xi),Object(y.fromString)(e,Xi),!0),r=new h.HKDF(f.SHA256,n).expand(32);return Object(y.toString)(r,Xi)}function io(t){var e=Object(f.hash)(Object(y.fromString)(t,Xi));return Object(y.toString)(e,Xi)}function oo(t){var e=Object(f.hash)(Object(y.fromString)(t,$i));return Object(y.toString)(e,Xi)}function ao(t){return Number(Object(y.toString)(t,"base10"))}function so(t){var e=function(t){return Object(y.fromString)("".concat(t),"base10")}(N(t.type)<"u"?t.type:0);if(ao(e)===to&&N(t.senderPublicKey)>"u")throw new Error("Missing sender public key for type 1 envelope");var n=N(t.senderPublicKey)<"u"?Object(y.fromString)(t.senderPublicKey,Xi):void 0,r=N(t.iv)<"u"?Object(y.fromString)(t.iv,Xi):Object(d.randomBytes)(12);return function(t){if(ao(t.type)===to){if(N(t.senderPublicKey)>"u")throw new Error("Missing sender public key for type 1 envelope");return Object(y.toString)(Object(y.concat)([t.type,t.senderPublicKey,t.iv,t.sealed]),Ki)}return Object(y.toString)(Object(y.concat)([t.type,t.iv,t.sealed]),Ki)}({type:e,sealed:new l.ChaCha20Poly1305(Object(y.fromString)(t.symKey,Xi)).seal(r,Object(y.fromString)(t.message,$i)),iv:r,senderPublicKey:n})}function uo(t){var e=new l.ChaCha20Poly1305(Object(y.fromString)(t.symKey,Xi)),n=co(t.encoded),r=n.sealed,i=n.iv,o=e.open(i,r);if(null===o)throw new Error("Failed to decrypt");return Object(y.toString)(o,$i)}function co(t){var e=Object(y.fromString)(t,Ki),n=e.slice(0,1);if(ao(n)===to){var r=e.slice(1,33),i=e.slice(33,45);return{type:n,sealed:e.slice(45),iv:i,senderPublicKey:r}}var o=e.slice(1,13);return{type:n,sealed:e.slice(13),iv:o}}function lo(t,e){var n=co(t);return ho({type:ao(n.type),senderPublicKey:N(n.senderPublicKey)<"u"?Object(y.toString)(n.senderPublicKey,Xi):void 0,receiverPublicKey:null==e?void 0:e.receiverPublicKey})}function ho(t){var e=(null==t?void 0:t.type)||0;if(e===to){if(N(null==t?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(N(null==t?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:null==t?void 0:t.senderPublicKey,receiverPublicKey:null==t?void 0:t.receiverPublicKey}}function fo(t){return t.type===to&&"string"==typeof t.senderPublicKey&&"string"==typeof t.receiverPublicKey}function po(t){return(null==t?void 0:t.relay)||{protocol:"irn"}}function yo(t){var e=m.RELAY_JSONRPC[t];if(N(e)>"u")throw new Error("Relay Protocol not supported: ".concat(t));return e}var mo=Object.defineProperty,go=Object.defineProperties,vo=Object.getOwnPropertyDescriptors,wo=Object.getOwnPropertySymbols,bo=Object.prototype.hasOwnProperty,Mo=Object.prototype.propertyIsEnumerable,Ao=function(t,e,n){return e in t?mo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},No=function(t,e){for(var n in e||(e={}))bo.call(e,n)&&Ao(t,n,e[n]);if(wo){var r,i=I(wo(e));try{for(i.s();!(r=i.n()).done;)n=r.value,Mo.call(e,n)&&Ao(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t};function Io(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",n={},r="relay"+e;return Object.keys(t).forEach((function(e){if(e.startsWith(r)){var i=e.replace(r,""),o=t[e];n[i]=o}})),n}function Eo(t){var e=(t=(t=t.includes("wc://")?t.replace("wc://",""):t).includes("wc:")?t.replace("wc:",""):t).indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e),i=t.substring(e+1,n).split("@"),o=N(n)<"u"?t.substring(n):"",a=c.parse(o),s="string"==typeof a.methods?a.methods.split(","):void 0;return{protocol:r,topic:xo(i[0]),version:parseInt(i[1],10),symKey:a.symKey,relay:Io(a),methods:s,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function xo(t){return t.startsWith("//")?t.substring(2):t}function ko(t){return"".concat(t.protocol,":").concat(t.topic,"@").concat(t.version,"?")+c.stringify(No(function(t,e){return go(t,vo(e))}(No({symKey:t.symKey},function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",n="relay",r={};return Object.keys(t).forEach((function(i){var o=n+e+i;t[i]&&(r[o]=t[i])})),r}(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function To(t){var e=[];return t.forEach((function(t){var n=x(t.split(":"),2),r=n[0],i=n[1];e.push("".concat(r,":").concat(i))})),e}function Lo(t,e){for(var n=function(t){var e={};return null==t||t.forEach((function(t){var n=x(t.split(":"),2),r=n[0],i=n[1];e[r]||(e[r]={accounts:[],chains:[],events:[]}),e[r].accounts.push(t),e[r].chains.push("".concat(r,":").concat(i))})),e}(e=e.map((function(t){return t.replace("did:pkh:","")}))),r=0,i=Object.entries(n);r"u"}function _o(t,e){return!(!e||!Po(t))||"string"==typeof t&&!!t.trim().length}function Bo(t,e){return!(!e||!Po(t))||"number"==typeof t&&!isNaN(t)}function Ro(t,e){var n=e.requiredNamespaces,r=Object.keys(t.namespaces),i=Object.keys(n),o=!0;return!!J(i,r)&&(r.forEach((function(e){var r=t.namespaces[e],i=r.accounts,a=r.methods,s=r.events,u=To(i),c=n[e];J(j(e,c),u)&&J(c.methods,a)&&J(c.events,s)||(o=!1)})),o)}function Uo(t){return!(!_o(t,!1)||!t.includes(":"))&&2===t.split(":").length}function Qo(t){if(_o(t,!1))try{return N(new URL(t))<"u"}catch(t){return!1}return!1}function Yo(t){var e;return null==(e=null==t?void 0:t.proposer)?void 0:e.publicKey}function Wo(t){return null==t?void 0:t.topic}function Fo(t,e){var n=null;return _o(null==t?void 0:t.publicKey,!1)||(n=Co("MISSING_OR_INVALID","".concat(e," controller public key should be a string"))),n}function Vo(t){var e=!0;return Oo(t)?t.length&&(e=t.every((function(t){return _o(t,!1)}))):e=!1,e}function Ho(t,e){var n=null;return Object.values(t).forEach((function(t){if(!n){var r=function(t,e){var n=null;return Vo(null==t?void 0:t.methods)?Vo(null==t?void 0:t.events)||(n=Do("UNSUPPORTED_EVENTS","".concat(e,", events should be an array of strings or empty array for no events"))):n=Do("UNSUPPORTED_METHODS","".concat(e,", methods should be an array of strings or empty array for no methods")),n}(t,"".concat(e,", namespace"));r&&(n=r)}})),n}function Go(t,e,n){var r=null;if(t&&zo(t)){var i=Ho(t,e);i&&(r=i);var o=function(t,e,n){var r=null;return Object.entries(t).forEach((function(t){var i=x(t,2),o=i[0],a=i[1];if(!r){var s=function(t,e,n){var r=null;return Oo(e)&&e.length?e.forEach((function(t){r||Uo(t)||(r=Do("UNSUPPORTED_CHAINS","".concat(n,", chain ").concat(t,' should be a string and conform to "namespace:chainId" format')))})):Uo(t)||(r=Do("UNSUPPORTED_CHAINS","".concat(n,', chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }'))),r}(o,j(o,a),"".concat(e," ").concat(n));s&&(r=s)}})),r}(t,e,n);o&&(r=o)}else r=Co("MISSING_OR_INVALID","".concat(e,", ").concat(n," should be an object with data"));return r}function qo(t,e){var n=null;if(t&&zo(t)){var r=Ho(t,e);r&&(n=r);var i=function(t,e){var n=null;return Object.values(t).forEach((function(t){if(!n){var r=function(t,e){var n=null;return Oo(t)?t.forEach((function(t){n||function(t){if(_o(t,!1)&&t.includes(":")){var e=t.split(":");if(3===e.length){var n=e[0]+":"+e[1];return!!e[2]&&Uo(n)}}return!1}(t)||(n=Do("UNSUPPORTED_ACCOUNTS","".concat(e,", account ").concat(t,' should be a string and conform to "namespace:chainId:address" format')))})):n=Do("UNSUPPORTED_ACCOUNTS","".concat(e,', accounts should be an array of strings conforming to "namespace:chainId:address" format')),n}(null==t?void 0:t.accounts,"".concat(e," namespace"));r&&(n=r)}})),n}(t,e);i&&(n=i)}else n=Co("MISSING_OR_INVALID","".concat(e,", namespaces should be an object with data"));return n}function Zo(t){return _o(t.protocol,!0)}function Jo(t,e){var n=!1;return e&&!t?n=!0:t&&Oo(t)&&t.length&&t.forEach((function(t){n=Zo(t)})),n}function Xo(t){return"number"==typeof t}function Ko(t){return N(t)<"u"&&null!==N(t)}function $o(t){return!!(t&&"object"==N(t)&&t.code&&Bo(t.code,!1)&&t.message&&_o(t.message,!1))}function ta(t){return!(Po(t)||!_o(t.method,!1))}function ea(t){return!(Po(t)||Po(t.result)&&Po(t.error)||!Bo(t.id,!1)||!_o(t.jsonrpc,!1))}function na(t){return!(Po(t)||!_o(t.name,!1))}function ra(t,e){return!(!Uo(e)||!function(t){var e=[];return Object.values(t).forEach((function(t){e.push.apply(e,E(To(t.accounts)))})),e}(t).includes(e))}function ia(t,e,n){return!!_o(n,!1)&&function(t,e){var n=[];return Object.values(t).forEach((function(t){To(t.accounts).includes(e)&&n.push.apply(n,E(t.methods))})),n}(t,e).includes(n)}function oa(t,e,n){return!!_o(n,!1)&&function(t,e){var n=[];return Object.values(t).forEach((function(t){To(t.accounts).includes(e)&&n.push.apply(n,E(t.events))})),n}(t,e).includes(n)}function aa(t,e,n){var r=null,i=function(t){var e={};return Object.keys(t).forEach((function(n){var r;n.includes(":")?e[n]=t[n]:null==(r=t[n].chains)||r.forEach((function(r){e[r]={methods:t[n].methods,events:t[n].events}}))})),e}(t),o=function(t){var e={};return Object.keys(t).forEach((function(n){if(n.includes(":"))e[n]=t[n];else{var r=To(t[n].accounts);null==r||r.forEach((function(r){e[r]={accounts:t[n].accounts.filter((function(t){return t.includes("".concat(r,":"))})),methods:t[n].methods,events:t[n].events}}))}})),e}(e),a=Object.keys(i),s=Object.keys(o),u=sa(Object.keys(t)),c=sa(Object.keys(e)),l=u.filter((function(t){return!c.includes(t)}));return l.length&&(r=Co("NON_CONFORMING_NAMESPACES","".concat(n," namespaces keys don't satisfy requiredNamespaces.\n Required: ").concat(l.toString(),"\n Received: ").concat(Object.keys(e).toString()))),J(a,s)||(r=Co("NON_CONFORMING_NAMESPACES","".concat(n," namespaces chains don't satisfy required namespaces.\n Required: ").concat(a.toString(),"\n Approved: ").concat(s.toString()))),Object.keys(e).forEach((function(t){if(t.includes(":")&&!r){var i=To(e[t].accounts);i.includes(t)||(r=Co("NON_CONFORMING_NAMESPACES","".concat(n," namespaces accounts don't satisfy namespace accounts for ").concat(t,"\n Required: ").concat(t,"\n Approved: ").concat(i.toString())))}})),a.forEach((function(t){r||(J(i[t].methods,o[t].methods)?J(i[t].events,o[t].events)||(r=Co("NON_CONFORMING_NAMESPACES","".concat(n," namespaces events don't satisfy namespace events for ").concat(t))):r=Co("NON_CONFORMING_NAMESPACES","".concat(n," namespaces methods don't satisfy namespace methods for ").concat(t)))})),r}function sa(t){return E(new Set(t.map((function(t){return t.includes(":")?t.split(":")[0]:t}))))}function ua(t,e){return Bo(t,!1)&&t<=e.max&&t>=e.min}function ca(){var t=V();return new Promise((function(e){switch(t){case U:e(F()&&(null==navigator?void 0:navigator.onLine));break;case B:e(function(){return L(this,null,A().mark((function t(){var e;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(W()&&(void 0===r?"undefined":N(r))<"u"&&null!=r&&r.NetInfo)){t.next=5;break}return t.next=3,null==r?void 0:r.NetInfo.fetch();case 3:return e=t.sent,t.abrupt("return",null==e?void 0:e.isConnected);case 5:return t.abrupt("return",!0);case 6:case"end":return t.stop()}}),t)})))}());break;case R:e(!0);break;default:e(!0)}}))}function la(t){switch(V()){case U:!function(t){!W()&&F()&&(window.addEventListener("online",(function(){return t(!0)})),window.addEventListener("offline",(function(){return t(!1)})))}(t);break;case B:!function(t){W()&&(void 0===r?"undefined":N(r))<"u"&&null!=r&&r.NetInfo&&(null==r||r.NetInfo.addEventListener((function(e){return t(null==e?void 0:e.isConnected)})))}(t)}}var ha={},da=b((function t(){v(this,t)}),null,[{key:"get",value:function(t){return ha[t]}},{key:"set",value:function(t,e){ha[t]=e}},{key:"delete",value:function(t){delete ha[t]}}])}).call(this,n(33),n(26),n(116).Buffer)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(16);r.__exportStar(n(76),e),r.__exportStar(n(81),e),r.__exportStar(n(82),e),r.__exportStar(n(45),e)},function(t,e,n){n(7);var r=n(25);n.d(e,"parseConnectionError",(function(){return r.d}));var i=n(54);n.o(i,"IJsonRpcProvider")&&n.d(e,"IJsonRpcProvider",(function(){return i.IJsonRpcProvider})),n.o(i,"formatJsonRpcError")&&n.d(e,"formatJsonRpcError",(function(){return i.formatJsonRpcError})),n.o(i,"formatJsonRpcRequest")&&n.d(e,"formatJsonRpcRequest",(function(){return i.formatJsonRpcRequest})),n.o(i,"formatJsonRpcResult")&&n.d(e,"formatJsonRpcResult",(function(){return i.formatJsonRpcResult})),n.o(i,"getBigIntRpcId")&&n.d(e,"getBigIntRpcId",(function(){return i.getBigIntRpcId})),n.o(i,"isJsonRpcError")&&n.d(e,"isJsonRpcError",(function(){return i.isJsonRpcError})),n.o(i,"isJsonRpcRequest")&&n.d(e,"isJsonRpcRequest",(function(){return i.isJsonRpcRequest})),n.o(i,"isJsonRpcResponse")&&n.d(e,"isJsonRpcResponse",(function(){return i.isJsonRpcResponse})),n.o(i,"isJsonRpcResult")&&n.d(e,"isJsonRpcResult",(function(){return i.isJsonRpcResult})),n.o(i,"isLocalhostUrl")&&n.d(e,"isLocalhostUrl",(function(){return i.isLocalhostUrl})),n.o(i,"isReactNative")&&n.d(e,"isReactNative",(function(){return i.isReactNative})),n.o(i,"isWsUrl")&&n.d(e,"isWsUrl",(function(){return i.isWsUrl})),n.o(i,"payloadId")&&n.d(e,"payloadId",(function(){return i.payloadId}));var o=n(55);n.d(e,"formatJsonRpcError",(function(){return o.a})),n.d(e,"formatJsonRpcRequest",(function(){return o.b})),n.d(e,"formatJsonRpcResult",(function(){return o.c})),n.d(e,"getBigIntRpcId",(function(){return o.d})),n.d(e,"payloadId",(function(){return o.e})),n(56);var a=n(63);n.d(e,"IJsonRpcProvider",(function(){return a.a}));var s=n(57);n.d(e,"isLocalhostUrl",(function(){return s.a})),n.d(e,"isWsUrl",(function(){return s.b}));var u=n(58);n.d(e,"isJsonRpcError",(function(){return u.a})),n.d(e,"isJsonRpcRequest",(function(){return u.b})),n.d(e,"isJsonRpcResponse",(function(){return u.c})),n.d(e,"isJsonRpcResult",(function(){return u.d}))},function(t,e,n){n.d(e,"h",(function(){return r})),n.d(e,"i",(function(){return i})),n.d(e,"f",(function(){return o})),n.d(e,"g",(function(){return a})),n.d(e,"e",(function(){return s})),n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return c})),n.d(e,"d",(function(){return l})),n.d(e,"c",(function(){return h})),n.d(e,"l",(function(){return d})),n.d(e,"k",(function(){return f})),n.d(e,"m",(function(){return p})),n.d(e,"n",(function(){return y})),n.d(e,"j",(function(){return m}));var r="EdDSA",i="JWT",o=".",a="base64url",s="utf8",u="utf8",c=":",l="did",h="key",d="base58btc",f="z",p="K36",y=32,m=32},function(t,e,n){n.d(e,"a",(function(){return D})),n.d(e,"b",(function(){return O})),n.d(e,"c",(function(){return T})),n.d(e,"d",(function(){return j}));var r=n(15),i=n.n(r);n.d(e,"e",(function(){return i.a}));var o=n(8);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nthis.maxSizeInBytes)throw new Error("[LinkedList] Value too big to insert into list: ".concat(t," with size ").concat(e.size));for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}},{key:"shift",value:function(){if(this.head){var t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}}},{key:"toArray",value:function(){for(var t=[],e=this.head;null!==e;)t.push(e.value),e=e.next;return t}},{key:"length",get:function(){return this.lengthInNodes}},{key:"size",get:function(){return this.sizeInBytes}},{key:"toOrderedArray",value:function(){return Array.from(this)}},{key:Symbol.iterator,value:function(){var t=this.head;return{next:function(){if(!t)return{done:!0,value:null};var e=t.value;return t=t.next,{done:!1,value:e}}}}}]),m=l((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,t),this.level=null!=e?e:"error",this.levelValue=r.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new y(this.MAX_LOG_SIZE_IN_BYTES)}),[{key:"forwardToConsole",value:function(t,e){e===r.levels.values.error?console.error(t):e===r.levels.values.warn?console.warn(t):e===r.levels.values.debug?console.debug(t):e===r.levels.values.trace?console.trace(t):console.log(t)}},{key:"appendToLogs",value:function(t){this.logs.append(Object(o.b)({timestamp:(new Date).toISOString(),log:t}));var e="string"==typeof t?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}},{key:"getLogs",value:function(){return this.logs}},{key:"clearLogs",value:function(){this.logs=new y(this.MAX_LOG_SIZE_IN_BYTES)}},{key:"getLogArray",value:function(){return Array.from(this.logs)}},{key:"logsToBlob",value:function(t){var e=this.getLogArray();return e.push(Object(o.b)({extraMetadata:t})),new Blob(e,{type:"application/json"})}}]),g=l((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,t),this.baseChunkLogger=new m(e,n)}),[{key:"write",value:function(t){this.baseChunkLogger.appendToLogs(t)}},{key:"getLogs",value:function(){return this.baseChunkLogger.getLogs()}},{key:"clearLogs",value:function(){this.baseChunkLogger.clearLogs()}},{key:"getLogArray",value:function(){return this.baseChunkLogger.getLogArray()}},{key:"logsToBlob",value:function(t){return this.baseChunkLogger.logsToBlob(t)}},{key:"downloadLogsBlobInBrowser",value:function(t){var e=URL.createObjectURL(this.logsToBlob(t)),n=document.createElement("a");n.href=e,n.download="walletconnect-logs-".concat((new Date).toISOString(),".txt"),document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}}]),v=l((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,t),this.baseChunkLogger=new m(e,n)}),[{key:"write",value:function(t){this.baseChunkLogger.appendToLogs(t)}},{key:"getLogs",value:function(){return this.baseChunkLogger.getLogs()}},{key:"clearLogs",value:function(){this.baseChunkLogger.clearLogs()}},{key:"getLogArray",value:function(){return this.baseChunkLogger.getLogArray()}},{key:"logsToBlob",value:function(t){return this.baseChunkLogger.logsToBlob(t)}}]),w=Object.defineProperty,b=Object.defineProperties,M=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,E=function(t,e,n){return e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},x=function(t,e){for(var n in e||(e={}))N.call(e,n)&&E(t,n,e[n]);if(A){var r,i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw o}}}}(A(e));try{for(i.s();!(r=i.n()).done;)n=r.value,I.call(e,n)&&E(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},k=function(t,e){return b(t,M(e))};function T(t){return k(x({},t),{level:(null==t?void 0:t.level)||"info"})}function L(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;return t[e]||""}function S(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d;return t[n]=e,t}function j(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;return s(t.bindings)>"u"?L(t,e):t.bindings().context||""}function C(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,r=j(t,n);return r.trim()?"".concat(r,"/").concat(e):e}function D(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,r=C(t,e,n),i=t.child({context:r});return S(i,r,n)}function O(t){return s(t.loggerOverride)<"u"&&"string"!=typeof t.loggerOverride?{logger:t.loggerOverride,chunkLoggerController:null}:("undefined"==typeof window?"undefined":s(window))<"u"?function(t){var e,n,r=new g(null==(e=t.opts)?void 0:e.level,t.maxSizeInBytes);return{logger:i()(k(x({},t.opts),{level:"trace",browser:k(x({},null==(n=t.opts)?void 0:n.browser),{write:function(t){return r.write(t)}})})),chunkLoggerController:r}}(t):function(t){var e,n=new v(null==(e=t.opts)?void 0:e.level,t.maxSizeInBytes);return{logger:i()(k(x({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}(t)}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(109),i=n(42),o=n(110),a=n(17),s=n(20),u=n(111);e.compare=r.compare,e.concat=i.concat,e.equals=o.equals,e.fromString=a.fromString,e.toString=s.toString,e.xor=u.xor},function(t,e,n){var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}g(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&g(t,"error",e,{once:!0})}(t,i)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.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?s.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var i,o,a,s;if(c(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=l(t))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return t}function d(){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 f(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function p(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)o(u,this,e);else{var c=u.length,l=m(u,c);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):y.call(t,e)},s.prototype.listenerCount=y,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e,n){var i;return i=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e);if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e,"string"),(e="symbol"==r(i)?i:i+"")in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}n.d(e,"b",(function(){return o})),n.d(e,"d",(function(){return a})),n.d(e,"c",(function(){return s})),n.d(e,"e",(function(){return u})),n.d(e,"f",(function(){return c})),n.d(e,"a",(function(){return l}));var o="INTERNAL_ERROR",a="SERVER_ERROR",s=[-32700,-32600,-32601,-32602,-32603],u=[-32e3,-32099],c=i(i(i(i(i(i({},"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"}),o,{code:-32603,message:"Internal error"}),a,{code:-32e3,message:"Server error"}),l=a},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){if("string"!=typeof t)throw new Error("Cannot safe json parse value of type ".concat(r(t)));try{return e=t.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3'),JSON.parse(e,(function(t,e){return"string"==typeof e&&e.match(/^\d+n$/)?BigInt(e.substring(0,e.length-1)):e}))}catch(e){return t}var e}function o(t){return"string"==typeof t?t:(e=t,JSON.stringify(e,(function(t,e){return"bigint"==typeof e?e.toString()+"n":e}))||"");var e}n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o}))},function(t,e,n){(function(t){n.d(e,"a",(function(){return Ln})),n.d(e,"b",(function(){return _e})),n.d(e,"c",(function(){return De})),n.d(e,"d",(function(){return be})),n.d(e,"e",(function(){return Ne})),n.d(e,"f",(function(){return gn})),n.d(e,"g",(function(){return Re}));var r=n(6),i=n.n(r),o=n(64),a=n(27),s=n(4),u=n(11),c=n(8),l=n(31),h=n(0),d=n(5),f=n(1),p=n(72),y=n(2),m=n(65),g=n(66),v=n.n(g),w=n(67),b=n.n(w);function M(t){return function(t){if(Array.isArray(t))return P(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||z(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(t,e,n){return e=I(e),function(t,e){if(e&&("object"===k(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return N(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return!!t}()?Reflect.construct(e,n||[],I(t).constructor):e.apply(t,n))}function N(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function I(t){return(I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function E(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&x(t,e)}function x(t,e){return(x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function k(t){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function T(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */T=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof m?e:m,a=Object.create(o.prototype),s=new j(r||[]);return i(a,"_invoke",{value:E(t,n,s)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",f="executing",p="completed",y={};function m(){}function g(){}function v(){}var w={};c(w,a,(function(){return this}));var b=Object.getPrototypeOf,M=b&&b(b(C([])));M&&M!==n&&r.call(M,a)&&(w=M);var A=v.prototype=m.prototype=Object.create(w);function N(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function n(i,o,a,s){var u=h(t[i],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==k(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function E(e,n,r){var i=d;return function(o,a){if(i===f)throw Error("Generator is already running");if(i===p){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var u=x(s,r);if(u){if(u===y)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=h(e,n,r);if("normal"===c.type){if(i=r.done?p:"suspendedYield",c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=p,r.method="throw",r.arg=c.arg)}}}function x(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,x(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=h(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function L(t,e,n){return(e=D(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function S(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function j(t,e){for(var n=0;n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function z(t,e){if(t){if("string"==typeof t)return P(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r>>0,a=new Uint8Array(o);t[e];){var l=n[t.charCodeAt(e)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h>>0,a[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,e++}if(" "!==t[e]){for(var f=o-i;f!==o&&0===a[f];)f++;for(var p=new Uint8Array(r+(o-f)),y=r;f!==o;)p[y++]=a[f++];return p}}}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var a=(o-i)*l+1>>>0,c=new Uint8Array(a);i!==o;){for(var h=e[i],d=0,f=a-1;(0!==h||d>>0,c[f]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=a-r;p!==a&&0===c[p];)p++;for(var y=u.repeat(n);pn;)o+=e[i&s>>(a-=n)];if(a&&(o+=e[i&s<=8&&(u-=8,s[l++]=255&c>>u)}if(u>=n||255&c<<8-u)throw new SyntaxError("Unexpected end of data");return s}(t,i,r,e)}})},$=J({prefix:"\0",name:"identity",encode:function(t){return function(t){return(new TextDecoder).decode(t)}(t)},decode:function(t){return function(t){return(new TextEncoder).encode(t)}(t)}}),tt=Object.freeze({__proto__:null,identity:$}),et=K({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),nt=Object.freeze({__proto__:null,base2:et}),rt=K({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),it=Object.freeze({__proto__:null,base8:rt}),ot=X({prefix:"9",name:"base10",alphabet:"0123456789"}),at=Object.freeze({__proto__:null,base10:ot}),st=K({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ut=K({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),ct=Object.freeze({__proto__:null,base16:st,base16upper:ut}),lt=K({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ht=K({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),dt=K({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ft=K({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pt=K({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),yt=K({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),mt=K({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gt=K({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),vt=K({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),wt=Object.freeze({__proto__:null,base32:lt,base32upper:ht,base32pad:dt,base32padupper:ft,base32hex:pt,base32hexupper:yt,base32hexpad:mt,base32hexpadupper:gt,base32z:vt}),bt=X({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Mt=X({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),At=Object.freeze({__proto__:null,base36:bt,base36upper:Mt}),Nt=X({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),It=X({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Et=Object.freeze({__proto__:null,base58btc:Nt,base58flickr:It}),xt=K({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),kt=K({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Tt=K({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Lt=K({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),St=Object.freeze({__proto__:null,base64:xt,base64pad:kt,base64url:Tt,base64urlpad:Lt}),jt=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Ct=jt.reduce((function(t,e,n){return t[n]=e,t}),[]),Dt=jt.reduce((function(t,e,n){return t[e.codePointAt(0)]=n,t}),[]),Ot=J({prefix:"🚀",name:"base256emoji",encode:function(t){return t.reduce((function(t,e){return t+Ct[e]}),"")},decode:function(t){var e,n=[],r=O(t);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Dt[i.codePointAt(0)];if(void 0===o)throw new Error("Non-base256emoji character: ".concat(i));n.push(o)}}catch(t){r.e(t)}finally{r.f()}return new Uint8Array(n)}}),zt=Object.freeze({__proto__:null,base256emoji:Ot}),Pt=Math.pow(2,31),_t=Math.pow(2,7),Bt=Math.pow(2,14),Rt=Math.pow(2,21),Ut=Math.pow(2,28),Qt=Math.pow(2,35),Yt=Math.pow(2,42),Wt=Math.pow(2,49),Ft=Math.pow(2,56),Vt=Math.pow(2,63),Ht=function t(e,n,r){n=n||[];for(var i=r=r||0;e>=Pt;)n[r++]=255&e|128,e/=128;for(;-128&e;)n[r++]=255&e|128,e>>>=7;return n[r]=0|e,t.bytes=r-i+1,n},Gt=function(t){return t<_t?1:t2&&void 0!==arguments[2]?arguments[2]:0;return Ht(t,e,n),e},Zt=function(t){return Gt(t)},Jt=function(t,e){var n=e.byteLength,r=Zt(t),i=r+Zt(n),o=new Uint8Array(i+n);return qt(t,o,0),qt(n,o,r),o.set(e,i),new Xt(t,n,e,o)},Xt=C((function t(e,n,r,i){S(this,t),this.code=e,this.size=n,this.digest=r,this.bytes=i})),Kt=function(t){var e=t.name,n=t.code,r=t.encode;return new $t(e,n,r)},$t=C((function t(e,n,r){S(this,t),this.name=e,this.code=n,this.encode=r}),[{key:"digest",value:function(t){var e=this;if(t instanceof Uint8Array){var n=this.encode(t);return n instanceof Uint8Array?Jt(this.code,n):n.then((function(t){return Jt(e.code,t)}))}throw Error("Unknown type, must be binary type")}}]),te=function(t){return function(e){return W(void 0,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.t0=Uint8Array,n.next=3,crypto.subtle.digest(t,e);case 3:return n.t1=n.sent,n.abrupt("return",new n.t0(n.t1));case 5:case"end":return n.stop()}}),n)})))}},ee=Kt({name:"sha2-256",code:18,encode:te("SHA-256")}),ne=Kt({name:"sha2-512",code:19,encode:te("SHA-512")}),re=Object.freeze({__proto__:null,sha256:ee,sha512:ne}),ie=F,oe={code:0,name:"identity",encode:ie,digest:function(t){return Jt(0,ie(t))}},ae=Object.freeze({__proto__:null,identity:oe});new TextEncoder,new TextDecoder;var se=Y(Y(Y(Y(Y(Y(Y(Y(Y(Y({},tt),nt),it),at),ct),wt),At),Et),St),zt);function ue(t){return null!=globalThis.Buffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function ce(t,e,n,r){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:n},decoder:{decode:r}}}Y(Y({},re),ae);var le=ce("utf8","u",(function(t){return"u"+new TextDecoder("utf8").decode(t)}),(function(t){return(new TextEncoder).encode(t.substring(1))})),he=ce("ascii","a",(function(t){for(var e="a",n=0;n0&&void 0!==arguments[0]?arguments[0]:0;return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?ue(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}((t=t.substring(1)).length),n=0;n1&&void 0!==arguments[1]?arguments[1]:"utf8",n=de[e];if(!n)throw new Error('Unsupported encoding "'.concat(e,'"'));return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode("".concat(n.prefix).concat(t)):ue(globalThis.Buffer.from(t,"utf-8"))}var pe="core",ye="".concat("wc","@2:").concat(pe,":"),me={database:":memory:"},ge="client_ed25519_seed",ve=f.ONE_DAY,we=f.SIX_HOURS,be="irn",Me="wss://relay.walletconnect.com",Ae="wss://relay.walletconnect.org",Ne={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Ie="payload",Ee="connect",xe="disconnect",ke="error",Te=f.ONE_SECOND,Le="subscription_created",Se="subscription_deleted",je=(f.THIRTY_DAYS,1e3*f.FIVE_SECONDS),Ce=(f.THIRTY_DAYS,{wc_pairingDelete:{req:{ttl:f.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:f.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:f.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:f.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:f.ONE_DAY,prompt:!1,tag:0},res:{ttl:f.ONE_DAY,prompt:!1,tag:0}}}),De={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Oe="history_created",ze="history_updated",Pe="history_deleted",_e={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Be=(f.ONE_DAY,"verify-api"),Re="https://verify.walletconnect.com",Ue="https://verify.walletconnect.org",Qe=[Re,Ue],Ye=C((function t(e,n){var r=this;S(this,t),this.core=e,this.logger=n,this.keychain=new Map,this.name="keychain",this.version="0.3",this.initialized=!1,this.storagePrefix=ye,this.init=function(){return W(r,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.initialized){t.next=5;break}return t.next=3,this.getKeyChain();case 3:k(e=t.sent)<"u"&&(this.keychain=e),this.initialized=!0;case 5:case"end":return t.stop()}}),t,this)})))},this.has=function(t){return r.isInitialized(),r.keychain.has(t)},this.set=function(t,e){return W(r,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.keychain.set(t,e),n.next=4,this.persist();case 4:case"end":return n.stop()}}),n,this)})))},this.get=function(t){r.isInitialized();var e=r.keychain.get(t);if(k(e)>"u"){var n=Object(h.A)("NO_MATCHING_KEY","".concat(r.name,": ").concat(t)).message;throw new Error(n)}return e},this.del=function(t){return W(r,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),this.keychain.delete(t),e.next=4,this.persist();case 4:case"end":return e.stop()}}),e,this)})))},this.core=e,this.logger=Object(s.a)(n,this.name)}),[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"setKeyChain",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,Object(h.ob)(t));case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getKeyChain",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return e=t.sent,t.abrupt("return",k(e)<"u"?Object(h.qb)(e):void 0);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setKeyChain(this.keychain);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}]),We=C((function t(e,n,r){var i=this;S(this,t),this.core=e,this.logger=n,this.name="crypto",this.initialized=!1,this.init=function(){return W(i,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=5;break}return t.next=4,this.keychain.init();case 4:this.initialized=!0;case 5:case"end":return t.stop()}}),t,this)})))},this.hasKeys=function(t){return i.isInitialized(),i.keychain.has(t)},this.getClientId=function(){return W(i,null,T().mark((function t(){var e,n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isInitialized(),t.next=3,this.getClientSeed();case 3:return e=t.sent,n=l.generateKeyPair(e),t.abrupt("return",l.encodeIss(n.publicKey));case 6:case"end":return t.stop()}}),t,this)})))},this.generateKeyPair=function(){i.isInitialized();var t=Object(h.t)();return i.setPrivateKey(t.publicKey,t.privateKey)},this.signJWT=function(t){return W(i,null,T().mark((function e(){var n,r,i,o;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.getClientSeed();case 3:return n=e.sent,r=l.generateKeyPair(n),i=Object(h.u)(),o=ve,e.next=9,l.signJWT(i,t,o,r);case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e,this)})))},this.generateSharedKey=function(t,e,n){i.isInitialized();var r=i.getPrivateKey(t),o=Object(h.k)(r,e);return i.setSymKey(o,n)},this.setSymKey=function(t,e){return W(i,null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),r=e||Object(h.I)(t),n.next=4,this.keychain.set(r,t);case 4:return n.abrupt("return",r);case 5:case"end":return n.stop()}}),n,this)})))},this.deleteKeyPair=function(t){return W(i,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.keychain.del(t);case 3:case"end":return e.stop()}}),e,this)})))},this.deleteSymKey=function(t){return W(i,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.keychain.del(t);case 3:case"end":return e.stop()}}),e,this)})))},this.encode=function(t,e,n){return W(i,null,T().mark((function r(){var i,o,a,s,u,l,d;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this.isInitialized(),i=Object(h.wb)(n),o=Object(c.b)(e),!Object(h.T)(i)){r.next=7;break}return a=i.senderPublicKey,s=i.receiverPublicKey,r.next=6,this.generateSharedKey(a,s);case 6:t=r.sent;case 7:return u=this.getSymKey(t),l=i.type,d=i.senderPublicKey,r.abrupt("return",Object(h.m)({type:l,symKey:u,message:o,senderPublicKey:d}));case 9:case"end":return r.stop()}}),r,this)})))},this.decode=function(t,e,n){return W(i,null,T().mark((function r(){var i,o,a,s,u;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this.isInitialized(),i=Object(h.vb)(e,n),!Object(h.T)(i)){r.next=7;break}return o=i.receiverPublicKey,a=i.senderPublicKey,r.next=6,this.generateSharedKey(o,a);case 6:t=r.sent;case 7:return r.prev=7,s=this.getSymKey(t),u=Object(h.j)({symKey:s,encoded:e}),r.abrupt("return",Object(c.a)(u));case 12:return r.prev=12,r.t0=r.catch(7),r.t1=this.logger,r.t2="Failed to decode message from topic: '".concat(t,"', clientId: '"),r.next=18,this.getClientId();case 18:r.t3=r.sent,r.t4=r.t2.concat.call(r.t2,r.t3,"'"),r.t1.error.call(r.t1,r.t4),this.logger.error(r.t0);case 22:case"end":return r.stop()}}),r,this,[[7,12]])})))},this.getPayloadType=function(t){var e=Object(h.l)(t);return Object(h.i)(e.type)},this.getPayloadSenderPublicKey=function(t){var e=Object(h.l)(t);return e.senderPublicKey?Object(d.toString)(e.senderPublicKey,h.a):void 0},this.core=e,this.logger=Object(s.a)(n,this.name),this.keychain=r||new Ye(this.core,this.logger)}),[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"setPrivateKey",value:function(t,e){return W(this,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.keychain.set(t,e);case 2:return n.abrupt("return",t);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"getPrivateKey",value:function(t){return this.keychain.get(t)}},{key:"getClientSeed",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e="",t.prev=1,e=this.keychain.get(ge),t.next=10;break;case 5:return t.prev=5,t.t0=t.catch(1),e=Object(h.u)(),t.next=10,this.keychain.set(ge,e);case 10:return t.abrupt("return",fe(e,"base16"));case 11:case"end":return t.stop()}}),t,this,[[1,5]])})))}},{key:"getSymKey",value:function(t){return this.keychain.get(t)}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}]),Fe=function(t){function e(t,n){var r;return S(this,e),(r=A(this,e,[t,n])).logger=t,r.core=n,r.messages=new Map,r.name="messages",r.version="0.3",r.initialized=!1,r.storagePrefix=ye,r.init=function(){return W(N(r),null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.initialized){t.next=15;break}return this.logger.trace("Initialized"),t.prev=2,t.next=5,this.getRelayerMessages();case 5:k(e=t.sent)<"u"&&(this.messages=e),this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",size:this.messages.size}),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(2),this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(t.t0);case 12:return t.prev=12,this.initialized=!0,t.finish(12);case 15:case"end":return t.stop()}}),t,this,[[2,9,12,15]])})))},r.set=function(t,e){return W(N(r),null,T().mark((function n(){var r,i;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),r=Object(h.J)(e),k(i=this.messages.get(t))>"u"&&(i={}),n.t0=k(i[r])<"u",n.t0){n.next=10;break}return i[r]=e,this.messages.set(t,i),n.next=10,this.persist();case 10:return n.abrupt("return",r);case 11:case"end":return n.stop()}}),n,this)})))},r.get=function(t){r.isInitialized();var e=r.messages.get(t);return k(e)>"u"&&(e={}),e},r.has=function(t,e){return r.isInitialized(),k(r.get(t)[Object(h.J)(e)])<"u"},r.del=function(t){return W(N(r),null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),this.messages.delete(t),e.next=4,this.persist();case 4:case"end":return e.stop()}}),e,this)})))},r.logger=Object(s.a)(t,r.name),r.core=n,r}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"setRelayerMessages",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,Object(h.ob)(t));case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getRelayerMessages",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return e=t.sent,t.abrupt("return",k(e)<"u"?Object(h.qb)(e):void 0);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setRelayerMessages(this.messages);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.f),Ve=function(t){function e(t,n){var i;return S(this,e),(i=A(this,e,[t,n])).relayer=t,i.logger=n,i.events=new r.EventEmitter,i.name="publisher",i.queue=new Map,i.publishTimeout=Object(f.toMiliseconds)(f.ONE_MINUTE),i.failedPublishTimeout=Object(f.toMiliseconds)(f.ONE_SECOND),i.needsTransportRestart=!1,i.publish=function(t,e,n){return W(N(i),null,T().mark((function r(){var i,o,a,s,u,c,l,d,f,p,m,g=this;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:t,message:e,opts:n}}),o=(null==n?void 0:n.ttl)||we,a=Object(h.F)(n),s=(null==n?void 0:n.prompt)||!1,u=(null==n?void 0:n.tag)||0,c=(null==n?void 0:n.id)||Object(y.getBigIntRpcId)().toString(),l={topic:t,message:e,opts:{ttl:o,relay:a,prompt:s,tag:u,id:c}},d="Failed to publish payload, please try again. id:".concat(c," tag:").concat(u),f=Date.now(),m=1,r.prev=3;case 4:if(void 0!==p){r.next=20;break}if(!(Date.now()-f>this.publishTimeout)){r.next=7;break}throw new Error(d);case 7:return this.logger.trace({id:c,attempts:m},"publisher.publish - attempt ".concat(m)),r.next=10,Object(h.h)(this.rpcPublish(t,e,o,a,s,u,c).catch((function(t){return g.logger.warn(t)})),this.publishTimeout,d);case 10:return r.next=12,r.sent;case 12:if(p=r.sent,m++,r.t0=p,r.t0){r.next=18;break}return r.next=18,new Promise((function(t){return setTimeout(t,g.failedPublishTimeout)}));case 18:r.next=4;break;case 20:this.relayer.events.emit(Ne.publish,l),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:c,topic:t,message:e,opts:n}}),r.next=28;break;case 23:if(r.prev=23,r.t1=r.catch(3),this.logger.debug("Failed to Publish Payload"),this.logger.error(r.t1),null==(i=null==n?void 0:n.internal)||!i.throwOnFailedPublish){r.next=27;break}throw r.t1;case 27:this.queue.set(c,l);case 28:case"end":return r.stop()}}),r,this,[[3,23]])})))},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.relayer=t,i.logger=Object(s.a)(n,i.name),i.registerEventListeners(),i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"rpcPublish",value:function(t,e,n,r,i,o,a){var s,u,c,l,d={method:Object(h.E)(r.protocol).publish,params:{topic:t,message:e,ttl:n,prompt:i,tag:o},id:a};return Object(h.U)(null==(s=d.params)?void 0:s.prompt)&&(null==(u=d.params)||delete u.prompt),Object(h.U)(null==(c=d.params)?void 0:c.tag)&&(null==(l=d.params)||delete l.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}},{key:"removeRequestFromQueue",value:function(t){this.queue.delete(t)}},{key:"checkQueue",value:function(){var t=this;this.queue.forEach((function(e){return W(t,null,T().mark((function t(){var n,r,i;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.topic,r=e.message,i=e.opts,t.next=3,this.publish(n,r,i);case 3:case"end":return t.stop()}}),t,this)})))}))}},{key:"registerEventListeners",value:function(){var t=this;this.relayer.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){if(t.needsTransportRestart)return t.needsTransportRestart=!1,void t.relayer.events.emit(Ne.connection_stalled);t.checkQueue()})),this.relayer.on(Ne.message_ack,(function(e){t.removeRequestFromQueue(e.id.toString())}))}}])}(u.g),He=C((function t(){var e=this;S(this,t),this.map=new Map,this.set=function(t,n){var r=e.get(t);e.exists(t,n)||e.map.set(t,[].concat(M(r),[n]))},this.get=function(t){return e.map.get(t)||[]},this.exists=function(t,n){return e.get(t).includes(n)},this.delete=function(t,n){if(k(n)>"u")e.map.delete(t);else if(e.map.has(t)){var r=e.get(t);if(e.exists(t,n)){var i=r.filter((function(t){return t!==n}));i.length?e.map.set(t,i):e.map.delete(t)}}},this.clear=function(){e.map.clear()}}),[{key:"topics",get:function(){return Array.from(this.map.keys())}}]),Ge=Object.defineProperty,qe=Object.defineProperties,Ze=Object.getOwnPropertyDescriptors,Je=Object.getOwnPropertySymbols,Xe=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable,$e=function(t,e,n){return e in t?Ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},tn=function(t,e){for(var n in e||(e={}))Xe.call(e,n)&&$e(t,n,e[n]);if(Je){var r,i=O(Je(e));try{for(i.s();!(r=i.n()).done;)n=r.value,Ke.call(e,n)&&$e(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},en=function(t,e){return qe(t,Ze(e))},nn=function(t){function e(t,n){var i;return S(this,e),(i=A(this,e,[t,n])).relayer=t,i.logger=n,i.subscriptions=new Map,i.topicMap=new He,i.events=new r.EventEmitter,i.name="subscription",i.version="0.3",i.pending=new Map,i.cached=[],i.initialized=!1,i.pendingSubscriptionWatchLabel="pending_sub_watch_label",i.pollingInterval=20,i.storagePrefix=ye,i.subscribeTimeout=Object(f.toMiliseconds)(f.ONE_MINUTE),i.restartInProgress=!1,i.batchSubscribeTopicsLimit=500,i.init=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=7;break}return this.logger.trace("Initialized"),this.registerEventListeners(),t.next=6,this.relayer.core.crypto.getClientId();case 6:this.clientId=t.sent;case 7:case"end":return t.stop()}}),t,this)})))},i.subscribe=function(t,e){return W(N(i),null,T().mark((function n(){var r,i,o;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.restartToComplete();case 2:return this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:t,opts:e}}),n.prev=5,r=Object(h.F)(e),i={topic:t,relay:r},this.pending.set(t,i),n.next=10,this.rpcSubscribe(t,r);case 10:return o=n.sent,n.abrupt("return",("string"==typeof o&&(this.onSubscribe(o,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:t,opts:e}})),o));case 14:throw n.prev=14,n.t0=n.catch(5),this.logger.debug("Failed to Subscribe Topic"),this.logger.error(n.t0),n.t0;case 17:case"end":return n.stop()}}),n,this,[[5,14]])})))},i.unsubscribe=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.restartToComplete();case 2:if(this.isInitialized(),!(k(null==e?void 0:e.id)<"u")){n.next=8;break}return n.next=6,this.unsubscribeById(t,e.id,e);case 6:n.next=10;break;case 8:return n.next=10,this.unsubscribeByTopic(t,e);case 10:case"end":return n.stop()}}),n,this)})))},i.isSubscribed=function(t){return W(N(i),null,T().mark((function e(){var n,r=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.topics.includes(t)){e.next=2;break}return e.abrupt("return",!0);case 2:return n="".concat(this.pendingSubscriptionWatchLabel,"_").concat(t),e.next=5,new Promise((function(e,i){var o=new f.Watch;o.start(n);var a=setInterval((function(){!r.pending.has(t)&&r.topics.includes(t)&&(clearInterval(a),o.stop(n),e(!0)),o.elapsed(n)>=je&&(clearInterval(a),o.stop(n),i(new Error("Subscription resolution timeout")))}),r.pollingInterval)})).catch((function(){return!1}));case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})))},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.start=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.onConnect();case 2:case"end":return t.stop()}}),t,this)})))},i.stop=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.onDisconnect();case 2:case"end":return t.stop()}}),t,this)})))},i.restart=function(){return W(N(i),null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.restartInProgress=!0,t.next=3,this.restore();case 3:return t.next=5,this.reset();case 5:this.restartInProgress=!1;case 6:case"end":return t.stop()}}),t,this)})))},i.relayer=t,i.logger=Object(s.a)(n,i.name),i.clientId="",i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.subscriptions.size}},{key:"ids",get:function(){return Array.from(this.subscriptions.keys())}},{key:"values",get:function(){return Array.from(this.subscriptions.values())}},{key:"topics",get:function(){return this.topicMap.topics}},{key:"hasSubscription",value:function(t,e){var n=!1;try{n=this.getSubscription(t).topic===e}catch(t){}return n}},{key:"onEnable",value:function(){this.cached=[],this.initialized=!0}},{key:"onDisable",value:function(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}},{key:"unsubscribeByTopic",value:function(t,e){return W(this,null,T().mark((function n(){var r,i=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=this.topicMap.get(t),n.next=3,Promise.all(r.map((function(n){return W(i,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.unsubscribeById(t,n,e);case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))})));case 3:case"end":return n.stop()}}),n,this)})))}},{key:"unsubscribeById",value:function(t,e,n){return W(this,null,T().mark((function r(){var i,o;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}}),r.prev=1,i=Object(h.F)(n),r.next=5,this.rpcUnsubscribe(t,e,i);case 5:return o=Object(h.G)("USER_DISCONNECTED","".concat(this.name,", ").concat(t)),r.next=8,this.onUnsubscribe(t,e,o);case 8:this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}}),r.next=15;break;case 12:throw r.prev=12,r.t0=r.catch(1),this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(r.t0),r.t0;case 15:case"end":return r.stop()}}),r,this,[[1,12]])})))}},{key:"rpcSubscribe",value:function(t,e){return W(this,null,T().mark((function n(){var r,i=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r={method:Object(h.E)(e.protocol).subscribe,params:{topic:t}},this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),n.prev=2,n.next=5,Object(h.h)(this.relayer.request(r).catch((function(t){return i.logger.warn(t)})),this.subscribeTimeout);case 5:return n.next=7,n.sent;case 7:if(!n.sent){n.next=11;break}n.t0=Object(h.J)(t+this.clientId),n.next=12;break;case 11:n.t0=null;case 12:return n.abrupt("return",n.t0);case 15:n.prev=15,n.t1=n.catch(2),this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ne.connection_stalled);case 18:return n.abrupt("return",null);case 19:case"end":return n.stop()}}),n,this,[[2,15]])})))}},{key:"rpcBatchSubscribe",value:function(t){return W(this,null,T().mark((function e(){var n,r,i=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length){e.next=2;break}return e.abrupt("return");case 2:return n=t[0].relay,r={method:Object(h.E)(n.protocol).batchSubscribe,params:{topics:t.map((function(t){return t.topic}))}},this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),e.prev=4,e.next=7,Object(h.h)(this.relayer.request(r).catch((function(t){return i.logger.warn(t)})),this.subscribeTimeout);case 7:return e.next=9,e.sent;case 9:return e.abrupt("return",e.sent);case 12:e.prev=12,e.t0=e.catch(4),this.relayer.events.emit(Ne.connection_stalled);case 15:case"end":return e.stop()}}),e,this,[[4,12]])})))}},{key:"rpcUnsubscribe",value:function(t,e,n){var r={method:Object(h.E)(n.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}},{key:"onSubscribe",value:function(t,e){this.setSubscription(t,en(tn({},e),{id:t})),this.pending.delete(e.topic)}},{key:"onBatchSubscribe",value:function(t){var e=this;t.length&&t.forEach((function(t){e.setSubscription(t.id,tn({},t)),e.pending.delete(t.topic)}))}},{key:"onUnsubscribe",value:function(t,e,n){return W(this,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,n),r.next=4,this.relayer.messages.del(t);case 4:case"end":return r.stop()}}),r,this)})))}},{key:"setRelayerSubscriptions",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.relayer.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getRelayerSubscriptions",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.relayer.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"setSubscription",value:function(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}},{key:"addSubscription",value:function(t,e){this.subscriptions.set(t,tn({},e)),this.topicMap.set(e.topic,t),this.events.emit(Le,e)}},{key:"getSubscription",value:function(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});var e=this.subscriptions.get(t);if(!e){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw new Error(n)}return e}},{key:"deleteSubscription",value:function(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});var n=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(n.topic,t),this.events.emit(Se,en(tn({},n),{reason:e}))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setRelayerSubscriptions(this.values);case 2:this.events.emit("subscription_sync");case 3:case"end":return t.stop()}}),t,this)})))}},{key:"reset",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.cached.length){t.next=10;break}e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit),n=0;case 3:if(!(n"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.subscriptions.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),this.logger.error("".concat(this.name,": ").concat(JSON.stringify(this.values))),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored subscriptions for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",subscriptions:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore subscriptions for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"batchSubscribe",value:function(t){return W(this,null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.rpcBatchSubscribe(t);case 4:n=e.sent,Object(h.V)(n)&&this.onBatchSubscribe(n.map((function(e,n){return en(tn({},t[n]),{id:e})})));case 6:case"end":return e.stop()}}),e,this)})))}},{key:"onConnect",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.restart();case 2:this.onEnable();case 3:case"end":return t.stop()}}),t,this)})))}},{key:"onDisconnect",value:function(){this.onDisable()}},{key:"checkPending",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.initialized&&this.relayer.connected){t.next=2;break}return t.abrupt("return");case 2:return e=[],this.pending.forEach((function(t){e.push(t)})),t.next=6,this.batchSubscribe(e);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"registerEventListeners",value:function(){var t=this;this.relayer.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){return W(t,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.checkPending();case 2:case"end":return t.stop()}}),t,this)})))})),this.events.on(Le,(function(e){return W(t,null,T().mark((function t(){var n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Le,this.logger.info("Emitting ".concat(n)),this.logger.debug({type:"event",event:n,data:e}),t.next=5,this.persist();case 5:case"end":return t.stop()}}),t,this)})))})),this.events.on(Se,(function(e){return W(t,null,T().mark((function t(){var n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Se,this.logger.info("Emitting ".concat(n)),this.logger.debug({type:"event",event:n,data:e}),t.next=5,this.persist();case 5:case"end":return t.stop()}}),t,this)})))}))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}},{key:"restartToComplete",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.restartInProgress,!t.t0){t.next=4;break}return t.next=4,new Promise((function(t){var n=setInterval((function(){e.restartInProgress||(clearInterval(n),t())}),e.pollingInterval)}));case 4:case"end":return t.stop()}}),t,this)})))}}])}(u.k),rn=Object.defineProperty,on=Object.getOwnPropertySymbols,an=Object.prototype.hasOwnProperty,sn=Object.prototype.propertyIsEnumerable,un=function(t,e,n){return e in t?rn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},cn=function(t,e){for(var n in e||(e={}))an.call(e,n)&&un(t,n,e[n]);if(on){var r,i=O(on(e));try{for(i.s();!(r=i.n()).done;)n=r.value,sn.call(e,n)&&un(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},ln=function(t){function e(t){var n;return S(this,e),(n=A(this,e,[t])).protocol="wc",n.version=2,n.events=new r.EventEmitter,n.name="relayer",n.transportExplicitlyClosed=!1,n.initialized=!1,n.connectionAttemptInProgress=!1,n.connectionStatusPollingInterval=20,n.staleConnectionErrors=["socket hang up","socket stalled","interrupted"],n.hasExperiencedNetworkDisruption=!1,n.requestsInFlight=new Map,n.heartBeatTimeout=Object(f.toMiliseconds)(f.THIRTY_SECONDS+f.ONE_SECOND),n.request=function(t){return W(N(n),null,T().mark((function e(){var n,r,i,o,a,s=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.debug("Publishing Request Payload"),i=t.id||Object(y.getBigIntRpcId)().toString(),e.next=4,this.toEstablishConnection();case 4:return e.prev=4,o=this.provider.request(t),this.requestsInFlight.set(i,{promise:o,request:t}),this.logger.trace({id:i,method:t.method,topic:null==(n=t.params)?void 0:n.topic},"relayer.request - attempt to publish..."),e.next=9,new Promise((function(t,e){return W(s,null,T().mark((function n(){var r,a;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function(){e(new Error("relayer.request - publish interrupted, id: ".concat(i)))},this.provider.on(xe,r),n.next=4,o;case 4:a=n.sent,this.provider.off(xe,r),t(a);case 6:case"end":return n.stop()}}),n,this)})))}));case 9:return a=e.sent,e.abrupt("return",(this.logger.trace({id:i,method:t.method,topic:null==(r=t.params)?void 0:r.topic},"relayer.request - published"),a));case 13:throw e.prev=13,e.t0=e.catch(4),this.logger.debug("Failed to Publish Request: ".concat(i)),e.t0;case 16:return e.prev=16,this.requestsInFlight.delete(i),e.finish(16);case 19:case"end":return e.stop()}}),e,this,[[4,13,16,19]])})))},n.resetPingTimeout=function(){if(Object(h.N)())try{clearTimeout(n.pingTimeout),n.pingTimeout=setTimeout((function(){var t,e,r;null==(r=null==(e=null==(t=n.provider)?void 0:t.connection)?void 0:e.socket)||r.terminate()}),n.heartBeatTimeout)}catch(t){n.logger.warn(t)}},n.onPayloadHandler=function(t){n.onProviderPayload(t),n.resetPingTimeout()},n.onConnectHandler=function(){n.startPingTimeout(),n.events.emit(Ne.connect)},n.onDisconnectHandler=function(){n.onProviderDisconnect()},n.onProviderErrorHandler=function(t){n.logger.error(t),n.events.emit(Ne.error,t),n.logger.info("Fatal socket error received, closing transport"),n.transportClose()},n.registerProviderListeners=function(){n.provider.on(Ie,n.onPayloadHandler),n.provider.on(Ee,n.onConnectHandler),n.provider.on(xe,n.onDisconnectHandler),n.provider.on(ke,n.onProviderErrorHandler)},n.core=t.core,n.logger=k(t.logger)<"u"&&"string"!=typeof t.logger?Object(s.a)(t.logger,n.name):Object(s.e)(Object(s.c)({level:t.logger||"error"})),n.messages=new Fe(n.logger,t.core),n.subscriber=new nn(N(n),n.logger),n.publisher=new Ve(N(n),n.logger),n.relayUrl=(null==t?void 0:t.relayUrl)||Me,n.projectId=t.projectId,n.bundleId=Object(h.w)(),n.provider={},n}return E(e,t),C(e,[{key:"init",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.logger.trace("Initialized"),this.registerEventListeners(),t.next=4,this.createProvider();case 4:return t.next=6,Promise.all([this.messages.init(),this.subscriber.init()]);case 6:return t.prev=6,t.next=9,this.transportOpen();case 9:t.next=16;break;case 11:return t.prev=11,t.t0=t.catch(6),this.logger.warn("Connection via ".concat(this.relayUrl," failed, attempting to connect via failover domain ").concat(Ae,"...")),t.next=16,this.restartTransport(Ae);case 16:this.initialized=!0,setTimeout((function(){return W(e,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=0===this.subscriber.topics.length&&0===this.subscriber.pending.size,!t.t0){t.next=6;break}return this.logger.info("No topics subscribed to after init, closing transport"),t.next=5,this.transportClose();case 5:this.transportExplicitlyClosed=!1;case 6:case"end":return t.stop()}}),t,this)})))}),1e4);case 17:case"end":return t.stop()}}),t,this,[[6,11]])})))}},{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"connected",get:function(){var t,e,n;return 1===(null==(n=null==(e=null==(t=this.provider)?void 0:t.connection)?void 0:e.socket)?void 0:n.readyState)}},{key:"connecting",get:function(){var t,e,n;return 0===(null==(n=null==(e=null==(t=this.provider)?void 0:t.connection)?void 0:e.socket)?void 0:n.readyState)}},{key:"publish",value:function(t,e,n){return W(this,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.isInitialized(),r.next=3,this.publisher.publish(t,e,n);case 3:return r.next=5,this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now()});case 5:case"end":return r.stop()}}),r,this)})))}},{key:"subscribe",value:function(t,e){return W(this,null,T().mark((function n(){var r,i,o,a,s=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),i=(null==(r=this.subscriber.topicMap.get(t))?void 0:r[0])||"",a=function e(n){n.topic===t&&(s.subscriber.off(Le,e),o())},n.next=5,Promise.all([new Promise((function(t){o=t,s.subscriber.on(Le,a)})),new Promise((function(n){return W(s,null,T().mark((function r(){return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.subscriber.subscribe(t,e);case 2:if(r.t0=r.sent,r.t0){r.next=5;break}r.t0=i;case 5:i=r.t0,n();case 7:case"end":return r.stop()}}),r,this)})))}))]);case 5:return n.abrupt("return",i);case 6:case"end":return n.stop()}}),n,this)})))}},{key:"unsubscribe",value:function(t,e){return W(this,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),n.next=3,this.subscriber.unsubscribe(t,e);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"on",value:function(t,e){this.events.on(t,e)}},{key:"once",value:function(t,e){this.events.once(t,e)}},{key:"off",value:function(t,e){this.events.off(t,e)}},{key:"removeListener",value:function(t,e){this.events.removeListener(t,e)}},{key:"transportDisconnect",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)){t.next=9;break}return t.prev=1,t.next=4,Promise.all(Array.from(this.requestsInFlight.values()).map((function(t){return t.promise})));case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),this.logger.warn(t.t0);case 9:if(!this.hasExperiencedNetworkDisruption&&!this.connected){t.next=14;break}return t.next=12,Object(h.h)(this.provider.disconnect(),2e3,"provider.disconnect()").catch((function(){return e.onProviderDisconnect()}));case 12:t.next=15;break;case 14:this.onProviderDisconnect();case 15:case"end":return t.stop()}}),t,this,[[1,6]])})))}},{key:"transportClose",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.transportExplicitlyClosed=!0,t.next=3,this.transportDisconnect();case 3:case"end":return t.stop()}}),t,this)})))}},{key:"transportOpen",value:function(t){return W(this,null,T().mark((function e(){var n,r=this;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.confirmOnlineStateOrThrow();case 2:if(e.t0=t&&t!==this.relayUrl,!e.t0){e.next=9;break}return this.relayUrl=t,e.next=7,this.transportDisconnect();case 7:return e.next=9,this.createProvider();case 9:return this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1,e.prev=11,e.next=14,new Promise((function(t,e){return W(r,null,T().mark((function n(){var r,i=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function t(){i.provider.off(xe,t),e(new Error("Connection interrupted while trying to subscribe"))},this.provider.on(xe,r),n.next=4,Object(h.h)(this.provider.connect(),Object(f.toMiliseconds)(f.ONE_MINUTE),"Socket stalled when trying to connect to ".concat(this.relayUrl)).catch((function(t){e(t)}));case 4:return n.next=6,this.subscriber.start();case 6:this.hasExperiencedNetworkDisruption=!1,t();case 8:case"end":return n.stop()}}),n,this)})))}));case 14:e.next=22;break;case 16:if(e.prev=16,e.t1=e.catch(11),this.logger.error(e.t1),n=e.t1,this.isConnectionStalled(n.message)){e.next=22;break}throw e.t1;case 22:return e.prev=22,this.connectionAttemptInProgress=!1,e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[11,16,22,25]])})))}},{key:"restartTransport",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.connectionAttemptInProgress,e.t0){e.next=11;break}return this.relayUrl=t||this.relayUrl,e.next=5,this.confirmOnlineStateOrThrow();case 5:return e.next=7,this.transportClose();case 7:return e.next=9,this.createProvider();case 9:return e.next=11,this.transportOpen();case 11:case"end":return e.stop()}}),e,this)})))}},{key:"confirmOnlineStateOrThrow",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(h.O)();case 2:if(t.sent){t.next=4;break}throw new Error("No internet connection detected. Please restart your network and try again.");case 4:case"end":return t.stop()}}),t)})))}},{key:"startPingTimeout",value:function(){var t,e,n,r,i,o=this;if(Object(h.N)())try{null!=(e=null==(t=this.provider)?void 0:t.connection)&&e.socket&&(null==(i=null==(r=null==(n=this.provider)?void 0:n.connection)?void 0:r.socket)||i.once("ping",(function(){o.resetPingTimeout()}))),this.resetPingTimeout()}catch(t){this.logger.warn(t)}}},{key:"isConnectionStalled",value:function(t){return this.staleConnectionErrors.some((function(e){return t.includes(e)}))}},{key:"createProvider",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.provider.connection&&this.unregisterProviderListeners(),t.next=3,this.core.crypto.signJWT(this.relayUrl);case 3:e=t.sent,this.provider=new p.a(new m.a(Object(h.q)({sdkVersion:"2.12.2",protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners();case 5:case"end":return t.stop()}}),t,this)})))}},{key:"recordMessageEvent",value:function(t){return W(this,null,T().mark((function e(){var n,r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,r=t.message,e.next=3,this.messages.set(n,r);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"shouldIgnoreMessageEvent",value:function(t){return W(this,null,T().mark((function e(){var n,r,i;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.topic,(r=t.message)&&0!==r.length){e.next=3;break}return e.abrupt("return",(this.logger.debug("Ignoring invalid/empty message: ".concat(r)),!0));case 3:return e.next=5,this.subscriber.isSubscribed(n);case 5:if(e.sent){e.next=7;break}return e.abrupt("return",(this.logger.debug("Ignoring message for non-subscribed topic ".concat(n)),!0));case 7:return i=this.messages.has(n,r),e.abrupt("return",(i&&this.logger.debug("Ignoring duplicate message: ".concat(r)),i));case 9:case"end":return e.stop()}}),e,this)})))}},{key:"onProviderPayload",value:function(t){return W(this,null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),!Object(y.isJsonRpcRequest)(t)){e.next=13;break}if(t.method.endsWith("_subscription")){e.next=3;break}return e.abrupt("return");case 3:return n=t.params,r=n.data,i=r.topic,o=r.message,a=r.publishedAt,s={topic:i,message:o,publishedAt:a},this.logger.debug("Emitting Relayer Payload"),this.logger.trace(cn({type:"event",event:n.id},s)),this.events.emit(n.id,s),e.next=9,this.acknowledgePayload(t);case 9:return e.next=11,this.onMessageEvent(s);case 11:e.next=14;break;case 13:Object(y.isJsonRpcResponse)(t)&&this.events.emit(Ne.message_ack,t);case 14:case"end":return e.stop()}}),e,this)})))}},{key:"onMessageEvent",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.shouldIgnoreMessageEvent(t);case 2:if(e.t0=e.sent,e.t0){e.next=7;break}return this.events.emit(Ne.message,t),e.next=7,this.recordMessageEvent(t);case 7:case"end":return e.stop()}}),e,this)})))}},{key:"acknowledgePayload",value:function(t){return W(this,null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(y.formatJsonRpcResult)(t.id,!0),e.next=3,this.provider.connection.send(n);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"unregisterProviderListeners",value:function(){this.provider.off(Ie,this.onPayloadHandler),this.provider.off(Ee,this.onConnectHandler),this.provider.off(xe,this.onDisconnectHandler),this.provider.off(ke,this.onProviderErrorHandler)}},{key:"registerEventListeners",value:function(){return W(this,null,T().mark((function t(){var e,n=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(h.O)();case 2:e=t.sent,Object(h.ub)((function(t){return W(n,null,T().mark((function n(){var r=this;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.t0=e!==t,!n.t0){n.next=12;break}if(e=t,!t){n.next=8;break}return n.next=6,this.restartTransport().catch((function(t){return r.logger.error(t)}));case 6:n.next=12;break;case 8:return this.hasExperiencedNetworkDisruption=!0,n.next=11,this.transportDisconnect();case 11:this.transportExplicitlyClosed=!1;case 12:case"end":return n.stop()}}),n,this)})))}));case 4:case"end":return t.stop()}}),t)})))}},{key:"onProviderDisconnect",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.subscriber.stop();case 2:this.events.emit(Ne.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout((function(){return W(e,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.transportOpen().catch((function(t){return e.logger.error(t)}));case 2:case"end":return t.stop()}}),t,this)})))}),Object(f.toMiliseconds)(Te));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}},{key:"toEstablishConnection",value:function(){return W(this,null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.confirmOnlineStateOrThrow();case 2:if(t.t0=!this.connected,!t.t0){t.next=10;break}if(t.t1=this.connectionAttemptInProgress,!t.t1){t.next=8;break}return t.next=8,new Promise((function(t){var n=setInterval((function(){e.connected&&(clearInterval(n),t())}),e.connectionStatusPollingInterval)}));case 8:return t.next=10,this.transportOpen();case 10:case"end":return t.stop()}}),t,this)})))}}])}(u.h),hn=Object.defineProperty,dn=Object.getOwnPropertySymbols,fn=Object.prototype.hasOwnProperty,pn=Object.prototype.propertyIsEnumerable,yn=function(t,e,n){return e in t?hn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},mn=function(t,e){for(var n in e||(e={}))fn.call(e,n)&&yn(t,n,e[n]);if(dn){var r,i=O(dn(e));try{for(i.s();!(r=i.n()).done;)n=r.value,pn.call(e,n)&&yn(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},gn=function(t){function e(t,n,r){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ye,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;return S(this,e),(i=A(this,e,[t,n,r,o])).core=t,i.logger=n,i.name=r,i.map=new Map,i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=ye,i.recentlyDeleted=[],i.recentlyDeletedLimit=200,i.init=function(){return W(N(i),null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=8;break}return this.logger.trace("Initialized"),t.next=5,this.restore();case 5:this.cached.forEach((function(t){e.getKey&&null!==t&&!Object(h.U)(t)?e.map.set(e.getKey(t),t):Object(h.P)(t)?e.map.set(t.id,t):Object(h.S)(t)&&e.map.set(t.topic,t)})),this.cached=[],this.initialized=!0;case 8:case"end":return t.stop()}}),t,this)})))},i.set=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),!this.map.has(t)){n.next=6;break}return n.next=4,this.update(t,e);case 4:n.next=11;break;case 6:return this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:t,value:e}),this.map.set(t,e),n.next=11,this.persist();case 11:case"end":return n.stop()}}),n,this)})))},i.get=function(t){return i.isInitialized(),i.logger.debug("Getting value"),i.logger.trace({type:"method",method:"get",key:t}),i.getData(t)},i.getAll=function(t){return i.isInitialized(),t?i.values.filter((function(e){return Object.keys(t).every((function(n){return v()(e[n],t[n])}))})):i.values},i.update=function(t,e){return W(N(i),null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:t,update:e}),r=mn(mn({},this.getData(t)),e),this.map.set(t,r),n.next=5,this.persist();case 5:case"end":return n.stop()}}),n,this)})))},i.delete=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),n.t0=this.map.has(t),!n.t0){n.next=9;break}return this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:t,reason:e}),this.map.delete(t),this.addToRecentlyDeleted(t),n.next=9,this.persist();case 9:case"end":return n.stop()}}),n,this)})))},i.logger=Object(s.a)(n,i.name),i.storagePrefix=o,i.getKey=a,i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.map.size}},{key:"keys",get:function(){return Array.from(this.map.keys())}},{key:"values",get:function(){return Array.from(this.map.values())}},{key:"addToRecentlyDeleted",value:function(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}},{key:"setDataStore",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getDataStore",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getData",value:function(t){var e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){var n=Object(h.A)("MISSING_OR_INVALID","Record was recently deleted - ".concat(this.name,": ").concat(t)).message;throw this.logger.error(n),new Error(n)}var r=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw this.logger.error(r),new Error(r)}return e}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setDataStore(this.values);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getDataStore();case 3:if(!(k(e=t.sent)>"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.map.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored value for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",value:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore value for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.j),vn=C((function t(e,n){var r=this;S(this,t),this.core=e,this.logger=n,this.name="pairing",this.version="0.3",this.events=new i.a,this.initialized=!1,this.storagePrefix=ye,this.ignoredPayloadTypes=[h.c],this.registeredMethods=[],this.init=function(){return W(r,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=10;break}return t.next=4,this.pairings.init();case 4:return t.next=6,this.cleanup();case 6:this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized");case 10:case"end":return t.stop()}}),t,this)})))},this.register=function(t){var e=t.methods;r.isInitialized(),r.registeredMethods=M(new Set([].concat(M(r.registeredMethods),M(e))))},this.create=function(t){return W(r,null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),n=Object(h.u)(),e.next=4,this.core.crypto.setSymKey(n);case 4:return r=e.sent,i=Object(h.e)(f.FIVE_MINUTES),a={topic:r,expiry:i,relay:o={protocol:be},active:!1},s=Object(h.s)({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:n,relay:o,expiryTimestamp:i,methods:null==t?void 0:t.methods}),e.next=11,this.pairings.set(r,a);case 11:return e.next=13,this.core.relayer.subscribe(r);case 13:return this.core.expirer.set(r,i),e.abrupt("return",{topic:r,uri:s});case 15:case"end":return e.stop()}}),e,this)})))},this.pair=function(t){return W(r,null,T().mark((function e(){var n,r,i,o,a,s,u,c;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isInitialized(),this.isValidPair(t),n=Object(h.tb)(t.uri),r=n.topic,i=n.symKey,o=n.relay,a=n.expiryTimestamp,s=n.methods,!this.pairings.keys.includes(r)||!this.pairings.get(r).active){e.next=4;break}throw new Error("Pairing already exists: ".concat(r,". Please try again with a new connection URI."));case 4:return u=a||Object(h.e)(f.FIVE_MINUTES),c={topic:r,relay:o,expiry:u,active:!1,methods:s},e.next=7,this.pairings.set(r,c);case 7:if(this.core.expirer.set(r,u),e.t0=t.activatePairing,!e.t0){e.next=12;break}return e.next=12,this.activate({topic:r});case 12:if(this.events.emit(De.create,c),e.t1=this.core.crypto.keychain.has(r),e.t1){e.next=17;break}return e.next=17,this.core.crypto.setSymKey(i,r);case 17:return e.next=19,this.core.relayer.subscribe(r,{relay:o});case 19:return e.abrupt("return",c);case 20:case"end":return e.stop()}}),e,this)})))},this.activate=function(t){return W(r,[t],(function(t){var e=this,n=t.topic;return T().mark((function t(){var r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isInitialized(),r=Object(h.e)(f.THIRTY_DAYS),t.next=4,e.pairings.update(n,{active:!0,expiry:r});case 4:e.core.expirer.set(n,r);case 5:case"end":return t.stop()}}),t)}))()}))},this.ping=function(t){return W(r,null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.isValidPing(t);case 3:if(n=t.topic,!this.pairings.keys.includes(n)){e.next=15;break}return e.next=7,this.sendRequest(n,"wc_pairingPing",{});case 7:return r=e.sent,i=Object(h.f)(),o=i.done,a=i.resolve,s=i.reject,this.events.once(Object(h.n)("pairing_ping",r),(function(t){var e=t.error;e?s(e):a()})),e.next=15,o();case 15:case"end":return e.stop()}}),e,this)})))},this.updateExpiry=function(t){return W(r,[t],(function(t){var e=this,n=t.topic,r=t.expiry;return T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isInitialized(),t.next=3,e.pairings.update(n,{expiry:r});case 3:case"end":return t.stop()}}),t)}))()}))},this.updateMetadata=function(t){return W(r,[t],(function(t){var e=this,n=t.topic,r=t.metadata;return T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.isInitialized(),t.next=3,e.pairings.update(n,{peerMetadata:r});case 3:case"end":return t.stop()}}),t)}))()}))},this.getPairings=function(){return r.isInitialized(),r.pairings.values},this.disconnect=function(t){return W(r,null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.isValidDisconnect(t);case 3:if(n=t.topic,e.t0=this.pairings.keys.includes(n),!e.t0){e.next=10;break}return e.next=8,this.sendRequest(n,"wc_pairingDelete",Object(h.G)("USER_DISCONNECTED"));case 8:return e.next=10,this.deletePairing(n);case 10:case"end":return e.stop()}}),e,this)})))},this.sendRequest=function(t,e,n){return W(r,null,T().mark((function r(){var i,o,a;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcRequest)(e,n),r.next=3,this.core.crypto.encode(t,i);case 3:return o=r.sent,a=Ce[e].req,r.abrupt("return",(this.core.history.set(t,i),this.core.relayer.publish(t,o,a),i.id));case 6:case"end":return r.stop()}}),r,this)})))},this.sendResult=function(t,e,n){return W(r,null,T().mark((function r(){var i,o,a,s;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcResult)(t,n),r.next=3,this.core.crypto.encode(e,i);case 3:return o=r.sent,r.next=6,this.core.history.get(e,t);case 6:return a=r.sent,s=Ce[a.request.method].res,r.next=10,this.core.relayer.publish(e,o,s);case 10:return r.next=12,this.core.history.resolve(i);case 12:case"end":return r.stop()}}),r,this)})))},this.sendError=function(t,e,n){return W(r,null,T().mark((function r(){var i,o,a,s;return T().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcError)(t,n),r.next=3,this.core.crypto.encode(e,i);case 3:return o=r.sent,r.next=6,this.core.history.get(e,t);case 6:return a=r.sent,s=Ce[a.request.method]?Ce[a.request.method].res:Ce.unregistered_method.res,r.next=10,this.core.relayer.publish(e,o,s);case 10:return r.next=12,this.core.history.resolve(i);case 12:case"end":return r.stop()}}),r,this)})))},this.deletePairing=function(t,e){return W(r,null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.core.relayer.unsubscribe(t);case 2:return n.next=4,Promise.all([this.pairings.delete(t,Object(h.G)("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(t),e?Promise.resolve():this.core.expirer.del(t)]);case 4:case"end":return n.stop()}}),n,this)})))},this.cleanup=function(){return W(r,null,T().mark((function t(){var e,n=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.pairings.getAll().filter((function(t){return Object(h.M)(t.expiry)})),t.next=3,Promise.all(e.map((function(t){return n.deletePairing(t.topic)})));case 3:case"end":return t.stop()}}),t,this)})))},this.onRelayEventRequest=function(t){var e=t.topic,n=t.payload;switch(n.method){case"wc_pairingPing":return r.onPairingPingRequest(e,n);case"wc_pairingDelete":return r.onPairingDeleteRequest(e,n);default:return r.onUnknownRpcMethodRequest(e,n)}},this.onRelayEventResponse=function(t){return W(r,null,T().mark((function e(){var n,r,i;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,r=t.payload,e.next=4,this.core.history.get(n,r.id);case 4:i=e.sent.request.method,e.t0=i,e.next="wc_pairingPing"===e.t0?8:9;break;case 8:return e.abrupt("return",this.onPairingPingResponse(n,r));case 9:return e.abrupt("return",this.onUnknownRpcMethodResponse(i));case 10:case"end":return e.stop()}}),e,this)})))},this.onPairingPingRequest=function(t,e){return W(r,null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.id,n.prev=1,this.isValidPing({topic:t}),n.next=5,this.sendResult(r,t,!0);case 5:this.events.emit(De.ping,{id:r,topic:t}),n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(1),n.next=12,this.sendError(r,t,n.t0);case 12:this.logger.error(n.t0);case 13:case"end":return n.stop()}}),n,this,[[1,8]])})))},this.onPairingPingResponse=function(t,e){var n=e.id;setTimeout((function(){Object(y.isJsonRpcResult)(e)?r.events.emit(Object(h.n)("pairing_ping",n),{}):Object(y.isJsonRpcError)(e)&&r.events.emit(Object(h.n)("pairing_ping",n),{error:e.error})}),500)},this.onPairingDeleteRequest=function(t,e){return W(r,null,T().mark((function n(){var r;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.id,n.prev=1,this.isValidDisconnect({topic:t}),n.next=5,this.deletePairing(t);case 5:this.events.emit(De.delete,{id:r,topic:t}),n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(1),n.next=12,this.sendError(r,t,n.t0);case 12:this.logger.error(n.t0);case 13:case"end":return n.stop()}}),n,this,[[1,8]])})))},this.onUnknownRpcMethodRequest=function(t,e){return W(r,null,T().mark((function n(){var r,i,o;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=e.id,i=e.method,n.prev=1,!this.registeredMethods.includes(i)){n.next=4;break}return n.abrupt("return");case 4:return o=Object(h.G)("WC_METHOD_UNSUPPORTED",i),n.next=7,this.sendError(r,t,o);case 7:this.logger.error(o),n.next=15;break;case 10:return n.prev=10,n.t0=n.catch(1),n.next=14,this.sendError(r,t,n.t0);case 14:this.logger.error(n.t0);case 15:case"end":return n.stop()}}),n,this,[[1,10]])})))},this.onUnknownRpcMethodResponse=function(t){r.registeredMethods.includes(t)||r.logger.error(Object(h.G)("WC_METHOD_UNSUPPORTED",t))},this.isValidPair=function(t){var e;if(!Object(h.fb)(t)){var n=Object(h.A)("MISSING_OR_INVALID","pair() params: ".concat(t)).message;throw new Error(n)}if(!Object(h.nb)(t.uri)){var r=Object(h.A)("MISSING_OR_INVALID","pair() uri: ".concat(t.uri)).message;throw new Error(r)}var i=Object(h.tb)(t.uri);if(null==(e=null==i?void 0:i.relay)||!e.protocol){var o=Object(h.A)("MISSING_OR_INVALID","pair() uri#relay-protocol").message;throw new Error(o)}if(null==i||!i.symKey){var a=Object(h.A)("MISSING_OR_INVALID","pair() uri#symKey").message;throw new Error(a)}if(null!=i&&i.expiryTimestamp&&Object(f.toMiliseconds)(null==i?void 0:i.expiryTimestamp)"u"&&(n.response=Object(y.isJsonRpcError)(t)?{error:t.error}:{result:t.result},this.records.set(n.id,n),this.persist(),this.events.emit(ze,n));case 6:case"end":return e.stop()}}),e,this)})))},i.get=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:t,id:e}),n.next=5,this.getRecord(e);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n,this)})))},i.delete=function(t,e){i.isInitialized(),i.logger.debug("Deleting record"),i.logger.trace({type:"method",method:"delete",id:e}),i.values.forEach((function(n){if(n.topic===t){if(k(e)<"u"&&n.id!==e)return;i.records.delete(n.id),i.events.emit(Pe,n)}})),i.persist()},i.exists=function(t,e){return W(N(i),null,T().mark((function n(){return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),!this.records.has(e)){n.next=9;break}return n.next=4,this.getRecord(e);case 4:n.t1=n.sent.topic,n.t2=t,n.t0=n.t1===n.t2,n.next=10;break;case 9:n.t0=!1;case 10:return n.abrupt("return",n.t0);case 11:case"end":return n.stop()}}),n,this)})))},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.logger=Object(s.a)(n,i.name),i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"size",get:function(){return this.records.size}},{key:"keys",get:function(){return Array.from(this.records.keys())}},{key:"values",get:function(){return Array.from(this.records.values())}},{key:"pending",get:function(){var t=[];return this.values.forEach((function(e){if(!(k(e.response)<"u")){var n={topic:e.topic,request:Object(y.formatJsonRpcRequest)(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(n)}})),t}},{key:"setJsonRpcRecords",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getJsonRpcRecords",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getRecord",value:function(t){this.isInitialized();var e=this.records.get(t);if(!e){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw new Error(n)}return e}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setJsonRpcRecords(this.values);case 2:this.events.emit("history_sync");case 3:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getJsonRpcRecords();case 3:if(!(k(e=t.sent)>"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.records.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",records:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"registerEventListeners",value:function(){var t=this;this.events.on(Oe,(function(e){var n=Oe;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,record:e})})),this.events.on(ze,(function(e){var n=ze;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,record:e})})),this.events.on(Pe,(function(e){var n=Pe;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,record:e})})),this.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){t.cleanup()}))}},{key:"cleanup",value:function(){var t=this;try{this.isInitialized();var e=!1;this.records.forEach((function(n){Object(f.toMiliseconds)(n.expiry||0)-Date.now()<=0&&(t.logger.info("Deleting expired history log: ".concat(n.id)),t.records.delete(n.id),t.events.emit(Pe,n,!1),e=!0)})),e&&this.persist()}catch(e){this.logger.warn(e)}}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.e),bn=function(t){function e(t,n){var i;return S(this,e),(i=A(this,e,[t,n])).core=t,i.logger=n,i.expirations=new Map,i.events=new r.EventEmitter,i.name="expirer",i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=ye,i.init=function(){return W(N(i),null,T().mark((function t(){var e=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=9;break}return this.logger.trace("Initialized"),t.next=5,this.restore();case 5:this.cached.forEach((function(t){return e.expirations.set(t.target,t)})),this.cached=[],this.registerEventListeners(),this.initialized=!0;case 9:case"end":return t.stop()}}),t,this)})))},i.has=function(t){try{var e=i.formatTarget(t);return k(i.getExpiration(e))<"u"}catch(t){return!1}},i.set=function(t,e){i.isInitialized();var n=i.formatTarget(t),r={target:n,expiry:e};i.expirations.set(n,r),i.checkExpiry(n,r),i.events.emit(_e.created,{target:n,expiration:r})},i.get=function(t){i.isInitialized();var e=i.formatTarget(t);return i.getExpiration(e)},i.del=function(t){if(i.isInitialized(),i.has(t)){var e=i.formatTarget(t),n=i.getExpiration(e);i.expirations.delete(e),i.events.emit(_e.deleted,{target:e,expiration:n})}},i.on=function(t,e){i.events.on(t,e)},i.once=function(t,e){i.events.once(t,e)},i.off=function(t,e){i.events.off(t,e)},i.removeListener=function(t,e){i.events.removeListener(t,e)},i.logger=Object(s.a)(n,i.name),i}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.expirations.size}},{key:"keys",get:function(){return Array.from(this.expirations.keys())}},{key:"values",get:function(){return Array.from(this.expirations.values())}},{key:"formatTarget",value:function(t){if("string"==typeof t)return Object(h.r)(t);if("number"==typeof t)return Object(h.o)(t);var e=Object(h.A)("UNKNOWN_TYPE","Target type: ".concat(k(t))).message;throw new Error(e)}},{key:"setExpirations",value:function(t){return W(this,null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getExpirations",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.getItem(this.storageKey);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"persist",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setExpirations(this.values);case 2:this.events.emit(_e.sync);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"restore",value:function(){return W(this,null,T().mark((function t(){var e,n,r;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getExpirations();case 3:if(!(k(e=t.sent)>"u")&&e.length){t.next=6;break}return t.abrupt("return");case 6:if(!this.expirations.size){t.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=e,this.logger.debug("Successfully Restored expirations for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",expirations:this.values}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),this.logger.debug("Failed to Restore expirations for ".concat(this.name)),this.logger.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))}},{key:"getExpiration",value:function(t){var e=this.expirations.get(t);if(!e){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(t)).message;throw this.logger.warn(n),new Error(n)}return e}},{key:"checkExpiry",value:function(t,e){var n=e.expiry;Object(f.toMiliseconds)(n)-Date.now()<=0&&this.expire(t,e)}},{key:"expire",value:function(t,e){this.expirations.delete(t),this.events.emit(_e.expired,{target:t,expiration:e})}},{key:"checkExpirations",value:function(){var t=this;this.core.relayer.connected&&this.expirations.forEach((function(e,n){return t.checkExpiry(n,e)}))}},{key:"registerEventListeners",value:function(){var t=this;this.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){return t.checkExpirations()})),this.events.on(_e.created,(function(e){var n=_e.created;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,data:e}),t.persist()})),this.events.on(_e.expired,(function(e){var n=_e.expired;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,data:e}),t.persist()})),this.events.on(_e.deleted,(function(e){var n=_e.deleted;t.logger.info("Emitting ".concat(n)),t.logger.debug({type:"event",event:n,data:e}),t.persist()}))}},{key:"isInitialized",value:function(){if(!this.initialized){var t=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(t)}}}])}(u.d),Mn=function(e){function n(e,r){var i;return S(this,n),(i=A(this,n,[e,r])).projectId=e,i.logger=r,i.name=Be,i.initialized=!1,i.queue=[],i.verifyDisabled=!1,i.init=function(t){return W(N(i),null,T().mark((function e(){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.verifyDisabled&&!Object(h.Q)()&&Object(h.K)()){e.next=2;break}return e.abrupt("return");case 2:return n=this.getVerifyUrl(null==t?void 0:t.verifyUrl),this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n,e.prev=4,e.next=7,this.createIframe();case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(4),this.logger.info("Verify iframe failed to load: ".concat(this.verifyUrl)),this.logger.info(e.t0);case 12:if(this.initialized){e.next=22;break}return this.removeIframe(),this.verifyUrl=Ue,e.prev=14,e.next=17,this.createIframe();case 17:e.next=22;break;case 19:e.prev=19,e.t1=e.catch(14),this.logger.info("Verify iframe failed to load: ".concat(this.verifyUrl)),this.logger.info(e.t1),this.verifyDisabled=!0;case 22:case"end":return e.stop()}}),e,this,[[4,9],[14,19]])})))},i.register=function(t){return W(N(i),null,T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.initialized){e.next=4;break}this.sendPost(t.attestationId),e.next=7;break;case 4:return this.addToQueue(t.attestationId),e.next=7,this.init();case 7:case"end":return e.stop()}}),e,this)})))},i.resolve=function(t){return W(N(i),null,T().mark((function e(){var n,r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isDevEnv){e.next=2;break}return e.abrupt("return","");case 2:return n=this.getVerifyUrl(null==t?void 0:t.verifyUrl),e.prev=3,e.next=6,this.fetchAttestation(t.attestationId,n);case 6:r=e.sent,e.next=16;break;case 9:return e.prev=9,e.t0=e.catch(3),this.logger.info("failed to resolve attestation: ".concat(t.attestationId," from url: ").concat(n)),this.logger.info(e.t0),e.next=15,this.fetchAttestation(t.attestationId,Ue);case 15:r=e.sent;case 16:return e.abrupt("return",r);case 17:case"end":return e.stop()}}),e,this,[[3,9]])})))},i.fetchAttestation=function(t,e){return W(N(i),null,T().mark((function n(){var r,i;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.logger.info("resolving attestation: ".concat(t," from url: ").concat(e)),r=this.startAbortTimer(2*f.ONE_SECOND),n.next=4,fetch("".concat(e,"/attestation/").concat(t),{signal:this.abortController.signal});case 4:if(i=n.sent,clearTimeout(r),200!==i.status){n.next=12;break}return n.next=9,i.json();case 9:n.t0=n.sent,n.next=13;break;case 12:n.t0=void 0;case 13:return n.abrupt("return",n.t0);case 14:case"end":return n.stop()}}),n,this)})))},i.addToQueue=function(t){i.queue.push(t)},i.processQueue=function(){0!==i.queue.length&&(i.queue.forEach((function(t){return i.sendPost(t)})),i.queue=[])},i.sendPost=function(t){var e;try{if(!i.iframe)return;null==(e=i.iframe.contentWindow)||e.postMessage(t,"*"),i.logger.info("postMessage sent: ".concat(t," ").concat(i.verifyUrl))}catch(t){}},i.createIframe=function(){return W(N(i),null,T().mark((function t(){var e,n,r=this;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=function t(n){"verify_ready"===n.data&&(r.onInit(),window.removeEventListener("message",t),e())},t.next=3,Promise.race([new Promise((function(t){var i=document.getElementById(Be);if(i)return r.iframe=i,r.onInit(),t();window.addEventListener("message",n);var o=document.createElement("iframe");o.id=Be,o.src="".concat(r.verifyUrl,"/").concat(r.projectId),o.style.display="none",document.body.append(o),r.iframe=o,e=t})),new Promise((function(t,e){return setTimeout((function(){window.removeEventListener("message",n),e("verify iframe load timeout")}),Object(f.toMiliseconds)(f.FIVE_SECONDS))}))]);case 3:case"end":return t.stop()}}),t)})))},i.onInit=function(){i.initialized=!0,i.processQueue()},i.removeIframe=function(){i.iframe&&(i.iframe.remove(),i.iframe=void 0,i.initialized=!1)},i.getVerifyUrl=function(t){var e=t||Re;return Qe.includes(e)||(i.logger.info("verify url: ".concat(e,", not included in trusted list, assigning default: ").concat(Re)),e=Re),e},i.logger=Object(s.a)(r,i.name),i.verifyUrl=Re,i.abortController=new AbortController,i.isDevEnv=Object(h.N)()&&t.env.IS_VITEST,i}return E(n,e),C(n,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"startAbortTimer",value:function(t){var e=this;return this.abortController=new AbortController,setTimeout((function(){return e.abortController.abort()}),Object(f.toMiliseconds)(t))}}])}(u.l),An=function(t){function e(t,n){var r;return S(this,e),(r=A(this,e,[t,n])).projectId=t,r.logger=n,r.context="echo",r.registerDeviceToken=function(t){return W(N(r),null,T().mark((function e(){var n,r,i,o,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.clientId,r=t.token,i=t.notificationType,o=t.enableEncrypted,a=void 0!==o&&o,s="".concat("https://echo.walletconnect.com","/").concat(this.projectId,"/clients"),e.next=3,b()(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:i,token:r,always_raw:a})});case 3:case"end":return e.stop()}}),e,this)})))},r.logger=Object(s.a)(n,r.context),r}return E(e,t),C(e)}(u.b),Nn=Object.defineProperty,In=Object.getOwnPropertySymbols,En=Object.prototype.hasOwnProperty,xn=Object.prototype.propertyIsEnumerable,kn=function(t,e,n){return e in t?Nn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},Tn=function(t,e){for(var n in e||(e={}))En.call(e,n)&&kn(t,n,e[n]);if(In){var r,i=O(In(e));try{for(i.s();!(r=i.n()).done;)n=r.value,xn.call(e,n)&&kn(t,n,e[n])}catch(t){i.e(t)}finally{i.f()}}return t},Ln=function(t){function e(t){var n,i;S(this,e),(n=A(this,e,[t])).protocol="wc",n.version=2,n.name=pe,n.events=new r.EventEmitter,n.initialized=!1,n.on=function(t,e){return n.events.on(t,e)},n.once=function(t,e){return n.events.once(t,e)},n.off=function(t,e){return n.events.off(t,e)},n.removeListener=function(t,e){return n.events.removeListener(t,e)},n.projectId=null==t?void 0:t.projectId,n.relayUrl=(null==t?void 0:t.relayUrl)||Me,n.customStoragePrefix=null!=t&&t.customStoragePrefix?":".concat(t.customStoragePrefix):"";var u=Object(s.c)({level:"string"==typeof(null==t?void 0:t.logger)&&t.logger?t.logger:"error"}),c=Object(s.b)({opts:u,maxSizeInBytes:null==t?void 0:t.maxLogBlobSizeInBytes,loggerOverride:null==t?void 0:t.logger}),l=c.logger,h=c.chunkLoggerController;return n.logChunkController=h,null!=(i=n.logChunkController)&&i.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=function(){return W(n,null,T().mark((function t(){var e,n;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser,!t.t0){t.next=10;break}if(t.t1=null==(n=this.logChunkController),t.t1){t.next=10;break}return t.t2=n,t.next=7,this.crypto.getClientId();case 7:t.t3=t.sent,t.t4={clientId:t.t3},t.t2.downloadLogsBlobInBrowser.call(t.t2,t.t4);case 10:case"end":return t.stop()}}),t,this)})))}),n.logger=Object(s.a)(l,n.name),n.heartbeat=new a.HeartBeat,n.crypto=new We(n,n.logger,null==t?void 0:t.keychain),n.history=new wn(n,n.logger),n.expirer=new bn(n,n.logger),n.storage=null!=t&&t.storage?t.storage:new o.a(Tn(Tn({},me),null==t?void 0:t.storageOptions)),n.relayer=new ln({core:n,logger:n.logger,relayUrl:n.relayUrl,projectId:n.projectId}),n.pairing=new vn(n,n.logger),n.verify=new Mn(n.projectId||"",n.logger),n.echoClient=new An(n.projectId||"",n.logger),n}return E(e,t),C(e,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"start",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.initialized,t.t0){t.next=4;break}return t.next=4,this.initialize();case 4:case"end":return t.stop()}}),t,this)})))}},{key:"getLogsBlob",value:function(){return W(this,null,T().mark((function t(){var e;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=(e=this.logChunkController)){t.next=4;break}t.t0=void 0,t.next=10;break;case 4:return t.t1=e,t.next=7,this.crypto.getClientId();case 7:t.t2=t.sent,t.t3={clientId:t.t2},t.t0=t.t1.logsToBlob.call(t.t1,t.t3);case 10:return t.abrupt("return",t.t0);case 11:case"end":return t.stop()}}),t,this)})))}},{key:"initialize",value:function(){return W(this,null,T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.logger.trace("Initialized"),t.prev=1,t.next=4,this.crypto.init();case 4:return t.next=6,this.history.init();case 6:return t.next=8,this.expirer.init();case 8:return t.next=10,this.relayer.init();case 10:return t.next=12,this.heartbeat.init();case 12:return t.next=14,this.pairing.init();case 14:this.initialized=!0,this.logger.info("Core Initialization Success"),t.next=21;break;case 18:throw t.prev=18,t.t0=t.catch(1),this.logger.warn("Core Initialization Failure at epoch ".concat(Date.now()),t.t0),this.logger.error(t.t0.message),t.t0;case 21:case"end":return t.stop()}}),t,this,[[1,18]])})))}}],[{key:"init",value:function(t){return W(this,null,T().mark((function n(){var r,i;return T().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=new e(t),n.next=3,r.initialize();case 3:return n.next=5,r.crypto.getClientId();case 5:return i=n.sent,n.next=8,r.storage.setItem("WALLETCONNECT_CLIENT_ID",i);case 8:return n.abrupt("return",r);case 9:case"end":return n.stop()}}),n)})))}}])}(u.a)}).call(this,n(33))},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string";if(!t[e]||r(t[e])!==n)throw new Error('Missing or invalid "'.concat(e,'" param'))}function o(t,e,n){return!!(n.length?function(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}(t,e.length):function(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}(t,e.length))&&function(t,e){var n=!0;return e.forEach((function(e){e in t||(n=!1)})),n}(t,e)}function a(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_",r=t.split(n);return r[r.length-1].trim().toLowerCase()===e.trim().toLowerCase()}n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return a}))},function(t,e,n){n.d(e,"a",(function(){return y})),n.d(e,"b",(function(){return I})),n.d(e,"c",(function(){return x})),n.d(e,"d",(function(){return A})),n.d(e,"e",(function(){return m})),n.d(e,"f",(function(){return g})),n.d(e,"g",(function(){return v})),n.d(e,"h",(function(){return w})),n.d(e,"i",(function(){return E})),n.d(e,"j",(function(){return b})),n.d(e,"k",(function(){return M})),n.d(e,"l",(function(){return N}));var r=n(22),i=n(6),o=n.n(i);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var n=0;ne in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,u=(t,e)=>{for(var n in e||(e={}))o.call(e,n)&&s(t,n,e[n]);if(i)for(var n of i(e))a.call(e,n)&&s(t,n,e[n]);return t};Object.defineProperty(e,"__esModule",{value:!0});var c=n(95),l=n(18);class h{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class d{constructor(t,e,n){if(this.name=t,this.prefix=e,void 0===e.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if("string"==typeof t){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(t){return p(this,t)}}class f{constructor(t){this.decoders=t}or(t){return p(this,t)}decode(t){const e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const p=(t,e)=>new f(u(u({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class y{constructor(t,e,n,r){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=r,this.encoder=new h(t,e,n),this.decoder=new d(t,e,r)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const m=({name:t,prefix:e,encode:n,decode:r})=>new y(t,e,n,r);e.Codec=y,e.baseX=({prefix:t,name:e,alphabet:n})=>{const{encode:r,decode:i}=c(n,e);return m({prefix:t,name:e,encode:r,decode:t=>l.coerce(i(t))})},e.from=m,e.or=p,e.rfc4648=({name:t,prefix:e,bitsPerChar:n,alphabet:r})=>m({prefix:e,name:t,encode:t=>((t,e,n)=>{const r="="===e[e.length-1],i=(1<n;)a-=n,o+=e[i&s>>a];if(a&&(o+=e[i&s<((t,e,n,r)=>{const i={};for(let t=0;t=8&&(s-=8,a[c++]=255&u>>s)}if(s>=n||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a})(e,r,n,t)})},function(t,e,n){const r=n(86);t.exports=a;const i=function(){function t(t){return void 0!==t&&t}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e){return t(self)||t(window)||t(this)||{}}}().console||{},o={mapHttpRequest:p,mapHttpResponse:p,wrapRequestSerializer:y,wrapResponseSerializer:y,wrapErrorSerializer:y,req:p,res:p,err:function(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)void 0===e[n]&&(e[n]=t[n]);return e}};function a(t){(t=t||{}).browser=t.browser||{};const e=t.browser.transmit;if(e&&"function"!=typeof e.send)throw Error("pino: transmit option must have a send function");const n=t.browser.write||i;t.browser.write&&(t.browser.asObject=!0);const r=t.serializers||{},o=function(t,e){return Array.isArray(t)?t.filter((function(t){return"!stdSerializers.err"!==t})):!0===t&&Object.keys(e)}(t.browser.serialize,r);let u=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(u=!1),"function"==typeof n&&(n.error=n.fatal=n.warn=n.info=n.debug=n.trace=n),!1===t.enabled&&(t.level="silent");const h=t.level||"info",p=Object.create(n);p.log||(p.log=m),Object.defineProperty(p,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(p,"level",{get:function(){return this._level},set:function(t){if("silent"!==t&&!this.levels.values[t])throw Error("unknown level "+t);this._level=t,s(y,p,"error","log"),s(y,p,"fatal","error"),s(y,p,"warn","error"),s(y,p,"info","log"),s(y,p,"debug","log"),s(y,p,"trace","log")}});const y={transmit:e,serialize:o,asObject:t.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:f(t)};return p.levels=a.levels,p.level=h,p.setMaxListeners=p.getMaxListeners=p.emit=p.addListener=p.on=p.prependListener=p.once=p.prependOnceListener=p.removeListener=p.removeAllListeners=p.listeners=p.listenerCount=p.eventNames=p.write=p.flush=m,p.serializers=r,p._serialize=o,p._stdErrSerialize=u,p.child=function(n,i){if(!n)throw new Error("missing bindings for child Pino");i=i||{},o&&n.serializers&&(i.serializers=n.serializers);const a=i.serializers;if(o&&a){var s=Object.assign({},r,a),u=!0===t.browser.serialize?Object.keys(s):o;delete n.serializers,c([n],u,s,this._stdErrSerialize)}function h(t){this._childLevel=1+(0|t._childLevel),this.error=l(t,n,"error"),this.fatal=l(t,n,"fatal"),this.warn=l(t,n,"warn"),this.info=l(t,n,"info"),this.debug=l(t,n,"debug"),this.trace=l(t,n,"trace"),s&&(this.serializers=s,this._serialize=u),e&&(this._logEvent=d([].concat(t._logEvent.bindings,n)))}return h.prototype=this,new h(this)},e&&(p._logEvent=d()),p}function s(t,e,n,r){const o=Object.getPrototypeOf(e);e[n]=e.levelVal>e.levels.values[n]?m:o[n]?o[n]:i[n]||i[r]||m,function(t,e,n){var r;(t.transmit||e[n]!==m)&&(e[n]=(r=e[n],function(){const o=t.timestamp(),s=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var d=0;d-1&&r in n&&(t[i][r]=n[r](t[i][r]))}function l(t,e,n){return function(){const r=new Array(1+arguments.length);r[0]=e;for(var i=1;i