diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ff4c1936..85b52d2f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -80,13 +80,14 @@ jobs: uses: actions/setup-node@v4 with: node-version: "18" + cache: yarn - name: Install bos-workspace globally run: | if [ "${{ inputs.bw-legacy }}" = "true" ]; then - npm install -g bos-workspace@0.0.1-alpha.6 + yarn global add bos-workspace@0.0.1-alpha.6 else - npm install -g bos-workspace + npm global add bos-workspace fi - name: Build and deploy the workspace diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index 8cf5df46..00000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Lint Code Base - -on: - pull_request: - branches: [main] - -jobs: - lint: - name: Lint Code Base - runs-on: ubuntu-latest - - permissions: - contents: read - packages: read - statuses: write - - steps: - - name: Checkout - id: checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Node.js - id: setup-node - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: npm - - - name: Install Dependencies - id: install - run: npm install - - - name: Lint Code Base - id: super-linter - uses: super-linter/super-linter/slim@v5 - env: - DEFAULT_BRANCH: main - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - JAVASCRIPT_DEFAULT_STYLE: prettier - JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.yml - VALIDATE_JSCPD: false - VALIDATE_ALL_CODEBASE: false - VALIDATE_CSS: false - VALIDATE_MARKDOWN: false - FILTER_REGEX_EXCLUDE: .*/dist/.* diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6b7902f0..15da1c98 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,16 +15,16 @@ jobs: id: setup-node uses: actions/setup-node@v2 with: - node-version: 16 - cache: npm + node-version: 18 + cache: yarn registry-url: "https://registry.npmjs.org" - name: Install Dependencies id: install - run: npm install + run: yarn install - name: Publish to npm id: publish - run: npm publish + run: yarn npm publish env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 843f58a2..4798d642 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,12 +17,12 @@ jobs: id: setup-node uses: actions/setup-node@v2 with: - node-version: 16 - cache: npm + node-version: 18 + cache: yarn - name: Install Dependencies id: install - run: npm install + run: yarn install - name: Execute Test Tools - run: npm test + run: yarn run test diff --git a/.gitignore b/.gitignore index c90ac9ef..9348b614 100644 --- a/.gitignore +++ b/.gitignore @@ -21,9 +21,7 @@ Thumbs.db # Ignore built ts files dist/**/* - -# ignore yarn.lock -yarn.lock +/examples/**/build/ # tests __app_example_1/ \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..7ae82cd2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,29 @@ +# Contributing Guide + +Thank you for considering contributing to bos-workspace! Here are some guidelines to help you get started. + +## Getting Started + +To contribute to bos-workspace, follow these steps: + +1. Fork the repository on GitHub. +2. Clone your forked repository to your local machine. +3. Make your changes locally, see the [examples](./examples/) for how to do this. +4. Test your changes to ensure they work as expected. +5. Commit your changes with descriptive commit messages. We like [Semantic Commit Messages](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716). +6. Push your changes to your fork on GitHub. +7. Create a pull request to the main repository. + +## Code Style + +Please follow the existing code style and conventions used in the project. + +## Testing + +This repository uses jest unit tests, which can be found in [/tests](./tests/). Ensure that your changes include appropriate tests and that existing tests pass. + +## Submitting Issues + +If you encounter any issues or have feature requests, please submit them through GitHub issues. Include as much detail as possible to help us understand and address the problem efficiently. + +Thank you for your interest in contributing to bos-workspace! Your contributions are greatly appreciated. diff --git a/README.md b/README.md index 8f2c5b55..c7e78c54 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To begin, either [use this template repository](https://github.com/new?template_name=quickstart&template_owner=NEARBuilders) or install `bos-workspace` within an existing project: ```cmd -npm install bos-workspace +yarn add -D bos-workspace ``` Then, you can clone widgets from an existing [account](https://near.social/mob.near/widget/Everyone) via: diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000..49027217 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,16 @@ +# Examples + +This folder contains example apps demonstrating the various functionalities and use cases of the bos-workspace CLI. They serve as a reference for users to understand how to interact with the tool and leverage its features, as well as an environemnt for testing changes during development of this tool. + +## Contents + +- `/single`: Demonstrates basic usage of a single App. It is a reproduction of the [Guest Book](https://docs.near.org/tutorials/examples/guest-book) and is configured with aliases in both mainnet and testnet. +- `/multi`: Demonstrates basic usage of a Workspace with multiple apps. The `bos.workspace.json` makes reference to two simple Apps. + +## Usage + +To use these examples while developing the CLI locally, follow the below steps: + +1. From the root directory, ensure that you have installed the necessary dependencies, `yarn` +2. Run the `dev` script to watch for changes, `yarn dev` +3. Run one of the examples, referencing the local cli, e.g. `../bin/bw.js dev` or `../bin/bw.js ws dev` diff --git a/examples/multi/apps/GoodbyeNothing/bos.config.json b/examples/multi/apps/GoodbyeNothing/bos.config.json new file mode 100644 index 00000000..6dff13a1 --- /dev/null +++ b/examples/multi/apps/GoodbyeNothing/bos.config.json @@ -0,0 +1,3 @@ +{ + "account": "goodbyenothing.near" +} \ No newline at end of file diff --git a/examples/multi/apps/GoodbyeNothing/data.json b/examples/multi/apps/GoodbyeNothing/data.json new file mode 100644 index 00000000..0de83adc --- /dev/null +++ b/examples/multi/apps/GoodbyeNothing/data.json @@ -0,0 +1,3 @@ +{ + "goodbyenothing.near": {} +} diff --git a/examples/multi/apps/GoodbyeNothing/widget/GoodbyeNothing.js b/examples/multi/apps/GoodbyeNothing/widget/GoodbyeNothing.js new file mode 100644 index 00000000..ded73d6e --- /dev/null +++ b/examples/multi/apps/GoodbyeNothing/widget/GoodbyeNothing.js @@ -0,0 +1 @@ +return

goodbye nothing

; diff --git a/examples/multi/apps/HelloWorld/bos.config.json b/examples/multi/apps/HelloWorld/bos.config.json new file mode 100644 index 00000000..52d2f947 --- /dev/null +++ b/examples/multi/apps/HelloWorld/bos.config.json @@ -0,0 +1,3 @@ +{ + "account": "helloworld.near" +} \ No newline at end of file diff --git a/examples/multi/apps/HelloWorld/data.json b/examples/multi/apps/HelloWorld/data.json new file mode 100644 index 00000000..09024c2c --- /dev/null +++ b/examples/multi/apps/HelloWorld/data.json @@ -0,0 +1,3 @@ +{ + "helloworld.near": {} +} diff --git a/examples/multi/apps/HelloWorld/widget/HelloWorld.js b/examples/multi/apps/HelloWorld/widget/HelloWorld.js new file mode 100644 index 00000000..150e9ab6 --- /dev/null +++ b/examples/multi/apps/HelloWorld/widget/HelloWorld.js @@ -0,0 +1 @@ +return

hello world

; diff --git a/examples/multi/bos.workspace.json b/examples/multi/bos.workspace.json index 7de31531..a2c1d3e1 100644 --- a/examples/multi/bos.workspace.json +++ b/examples/multi/bos.workspace.json @@ -1,3 +1,3 @@ { - apps: ["./app1", "./app2", "./apps/*"] -} + "apps": ["./apps/*"] +} \ No newline at end of file diff --git a/examples/single/aliases.mainnet.json b/examples/single/aliases.mainnet.json new file mode 100644 index 00000000..483c5242 --- /dev/null +++ b/examples/single/aliases.mainnet.json @@ -0,0 +1,3 @@ +{ + "contract": "hello.near-examples.near" +} \ No newline at end of file diff --git a/examples/single/aliases.testnet.json b/examples/single/aliases.testnet.json new file mode 100644 index 00000000..bf75e885 --- /dev/null +++ b/examples/single/aliases.testnet.json @@ -0,0 +1,3 @@ +{ + "contract": "hello.near-examples.testnet" +} \ No newline at end of file diff --git a/examples/single/bos.config.json b/examples/single/bos.config.json index 5e1d8dd1..ad26b611 100644 --- a/examples/single/bos.config.json +++ b/examples/single/bos.config.json @@ -1,15 +1,10 @@ { - accounts: { - deploy: "deploy.near", - signer: "signer.near", - dev: "dev.near" - }, - format: true, - overrides: { - testnet: { - account: "testing.testnet", - format: false, - aliasesSrc: ["src/aliases.testnet.json"] + "account": "quickstart.near", + "aliases": ["./aliases.mainnet.json"], + "overrides": { + "testnet": { + "account": "quickstart.testnet", + "aliases": ["./aliases.testnet.json"] } } } diff --git a/examples/single/data.json b/examples/single/data.json new file mode 100644 index 00000000..6d1607ee --- /dev/null +++ b/examples/single/data.json @@ -0,0 +1,3 @@ +{ + "quickstart.near": {} +} diff --git a/examples/single/widget/home.jsx b/examples/single/widget/home.jsx index e69de29b..f32425a8 100644 --- a/examples/single/widget/home.jsx +++ b/examples/single/widget/home.jsx @@ -0,0 +1,60 @@ +const CONTRACT = "${alias_contract}"; // this will get replaced by bos-workspace according to -n {network_env} +const storedGreeting = Near.view(CONTRACT, "get_greeting") ?? "hello world"; + +if (!storedGreeting || context.loading) { + return "Loading..."; +} + +const [greeting, setGreeting] = useState(storedGreeting); +const [showSpinner, setShowSpinner] = useState(false); +const loggedIn = !!context.accountId; + +const onInputChange = ({ target }) => { + setGreeting(target.value); +}; + +const onBtnClick = () => { + setShowSpinner(true); + Near.call(CONTRACT, "set_greeting", { greeting }); + setShowSpinner(false); +}; + +const Main = styled.div` + font-family: -apple-system, BlinkMacSystemFont, Segoe UI +`; + +// Render +return ( +
+
+

Hello Near

+

+ A greeting stored in + {CONTRACT} +

+
+
+

+ The contract says: + {greeting} +

+ +
+ + + +
+
+
+); \ No newline at end of file diff --git a/gateway/dist/1008.d7a8f9159603702300d8.bundle.js b/gateway/dist/1008.d7a8f9159603702300d8.bundle.js deleted file mode 100644 index dd9baf1e..00000000 --- a/gateway/dist/1008.d7a8f9159603702300d8.bundle.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 1008.d7a8f9159603702300d8.bundle.js.LICENSE.txt */ -"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[1008],{61008:(e,t,r)=>{r.d(t,{default:()=>Ts});var n=r(17187),i=r.n(n),s=r(15501),o=r(512),a=r(31416),c=r(73294),u=r(57664),h=r(37466),l=r(66736),p=(r(62116),r(304),r(87283),r(93368));r(34155),Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable,Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable,Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;const d={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function f(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}var g=r(32543),y=r(90772),m=r(9107),v=r(38200);class w extends v.q{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class b extends v.q{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class _{constructor(e,t){this.logger=e,this.core=t}}class E extends v.q{constructor(e,t){super(),this.relayer=e,this.logger=t}}class I extends v.q{constructor(e){super()}}class S{constructor(e,t,r,n){this.core=e,this.logger=t,this.name=r}}class P extends v.q{constructor(e,t){super(),this.relayer=e,this.logger=t}}class O extends v.q{constructor(e,t){super(),this.core=e,this.logger=t}}class N{constructor(e,t){this.projectId=e,this.logger=t}}class R{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class C{constructor(e){this.client=e}}var x=r(85094),T=r(3478),A=r(34155),j=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,s=t.length;i"u")throw new Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function ie(e){return 1===e.type&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}var se=Object.defineProperty,oe=Object.getOwnPropertySymbols,ae=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable,ue=(e,t,r)=>t in e?se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,he=(e,t)=>{for(var r in t||(t={}))ae.call(t,r)&&ue(e,r,t[r]);if(oe)for(var r of oe(t))ce.call(t,r)&&ue(e,r,t[r]);return e};const le="ReactNative",pe={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},de="js";function fe(){return typeof B<"u"&&typeof B.versions<"u"&&typeof B.versions.node<"u"}function ge(){return!(0,W.getDocument)()&&!!(0,W.getNavigator)()&&navigator.product===le}function ye(){return!fe()&&!!(0,W.getNavigator)()}function me(){return ge()?pe.reactNative:fe()?pe.node:ye()?pe.browser:pe.unknown}function ve(e,t,n){const i=function(){if(me()===pe.reactNative&&typeof r.g<"u"&&typeof(null==r.g?void 0:r.g.Platform)<"u"){const{OS:e,Version:t}=r.g.Platform;return[e,t].join("-")}const e=t?K(t):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new q:"undefined"!=typeof navigator?K(navigator.userAgent):void 0!==A&&A.version?new U(A.version.slice(1)):null;var t;if(null===e)return"unknown";const n=e.os?e.os.replace(" ","").toLowerCase():"unknown";return"browser"===e.type?[n,e.name,e.version].join("-"):[n,e.version].join("-")}(),s=function(){var e;const t=me();return t===pe.browser?[t,(null==(e=(0,W.getLocation)())?void 0:e.host)||"unknown"].join(":"):t}();return[[e,t].join("-"),[de,n].join("-"),i,s].join("/")}function we(e,t){return e.filter((e=>t.includes(e))).length===e.length}function be(e){return Object.fromEntries(e.entries())}function _e(e){return new Map(Object.entries(e))}function Ee(e=l.FIVE_MINUTES,t){const r=(0,l.toMiliseconds)(e||l.FIVE_MINUTES);let n,i,s;return{resolve:e=>{s&&n&&(clearTimeout(s),n(e))},reject:e=>{s&&i&&(clearTimeout(s),i(e))},done:()=>new Promise(((e,o)=>{s=setTimeout((()=>{o(new Error(t))}),r),n=e,i=o}))}}function Ie(e,t,r){return new Promise((async(n,i)=>{const s=setTimeout((()=>i(new Error(r))),t);try{n(await e)}catch(e){i(e)}clearTimeout(s)}))}function Se(e,t){if("string"==typeof t&&t.startsWith(`${e}:`))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}if("id"===e.toLowerCase()){if("number"!=typeof t)throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function Pe(e){const[t,r]=e.split(":"),n={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof r)n.topic=r;else{if("id"!==t||!Number.isInteger(Number(r)))throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);n.id=Number(r)}return n}function Oe(e,t){return(0,l.fromMiliseconds)((t||Date.now())+(0,l.toMiliseconds)(e))}function Ne(e){return Date.now()>=(0,l.toMiliseconds)(e)}function Re(e,t){return`${e}${t?`:${t}`:""}`}function Ce(e){return e?.relay||{protocol:"irn"}}function xe(e){const t=p.RELAY_JSONRPC[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}var Te=Object.defineProperty,Ae=Object.getOwnPropertySymbols,je=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,Ue=(e,t,r)=>t in e?Te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;function ke(e,t="-"){const r={},n="relay"+t;return Object.keys(e).forEach((t=>{if(t.startsWith(n)){const i=t.replace(n,""),s=e[t];r[i]=s}})),r}function $e(e){return e.startsWith("//")?e.substring(2):e}function qe(e){const t=[];return e.forEach((e=>{const[r,n]=e.split(":");t.push(`${r}:${n}`)})),t}Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;const Le={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},Me={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ze(e,t){const{message:r,code:n}=Me[e];return{message:t?`${r} ${t}`:r,code:n}}function Ve(e,t){const{message:r,code:n}=Le[e];return{message:t?`${r} ${t}`:r,code:n}}function Ke(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}function We(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function Fe(e){return typeof e>"u"}function He(e,t){return!(!t||!Fe(e))||"string"==typeof e&&!!e.trim().length}function Be(e,t){return!(!t||!Fe(e))||"number"==typeof e&&!isNaN(e)}function Je(e){return!(!He(e,!1)||!e.includes(":"))&&2===e.split(":").length}function Ge(e){let t=!0;return Ke(e)?e.length&&(t=e.every((e=>He(e,!1)))):t=!1,t}function Qe(e,t){let r=null;return Object.values(e).forEach((e=>{if(r)return;const n=function(e,t){let r=null;return Ge(e?.methods)?Ge(e?.events)||(r=Ve("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):r=Ve("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),r}(e,`${t}, namespace`);n&&(r=n)})),r}function Ye(e,t){let r=null;if(e&&We(e)){const n=Qe(e,t);n&&(r=n);const i=function(e,t){let r=null;return Object.values(e).forEach((e=>{if(r)return;const n=function(e,t){let r=null;return Ke(e)?e.forEach((e=>{r||function(e){if(He(e,!1)&&e.includes(":")){const t=e.split(":");if(3===t.length){const e=t[0]+":"+t[1];return!!t[2]&&Je(e)}}return!1}(e)||(r=Ve("UNSUPPORTED_ACCOUNTS",`${t}, account ${e} should be a string and conform to "namespace:chainId:address" format`))})):r=Ve("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}(e?.accounts,`${t} namespace`);n&&(r=n)})),r}(e,t);i&&(r=i)}else r=ze("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function Ze(e){return He(e.protocol,!0)}function Xe(e){return typeof e<"u"&&null!==typeof e}function et(e,t){return!(!Je(t)||!function(e){const t=[];return Object.values(e).forEach((e=>{t.push(...qe(e.accounts))})),t}(e).includes(t))}function tt(e,t,r){let n=null;const i=function(e){const t={};return Object.keys(e).forEach((r=>{var n;r.includes(":")?t[r]=e[r]:null==(n=e[r].chains)||n.forEach((n=>{t[n]={methods:e[r].methods,events:e[r].events}}))})),t}(e),s=function(e){const t={};return Object.keys(e).forEach((r=>{if(r.includes(":"))t[r]=e[r];else{const n=qe(e[r].accounts);n?.forEach((n=>{t[n]={accounts:e[r].accounts.filter((e=>e.includes(`${n}:`))),methods:e[r].methods,events:e[r].events}}))}})),t}(t),o=Object.keys(i),a=Object.keys(s),c=rt(Object.keys(e)),u=rt(Object.keys(t)),h=c.filter((e=>!u.includes(e)));return h.length&&(n=ze("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.\n Required: ${h.toString()}\n Received: ${Object.keys(t).toString()}`)),we(o,a)||(n=ze("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.\n Required: ${o.toString()}\n Approved: ${a.toString()}`)),Object.keys(t).forEach((e=>{if(!e.includes(":")||n)return;const i=qe(t[e].accounts);i.includes(e)||(n=ze("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${e}\n Required: ${e}\n Approved: ${i.toString()}`))})),o.forEach((e=>{n||(we(i[e].methods,s[e].methods)?we(i[e].events,s[e].events)||(n=ze("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${e}`)):n=ze("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${e}`))})),n}function rt(e){return[...new Set(e.map((e=>e.includes(":")?e.split(":")[0]:e)))]}var nt=r(19303),it=r(56186);const st=e=>e.split("?")[0],ot="undefined"!=typeof WebSocket?WebSocket:void 0!==r.g&&void 0!==r.g.WebSocket?r.g.WebSocket:"undefined"!=typeof window&&void 0!==window.WebSocket?window.WebSocket:"undefined"!=typeof self&&void 0!==self.WebSocket?self.WebSocket:r(72030),at=class{constructor(e){if(this.url=e,this.events=new n.EventEmitter,this.registering=!1,!(0,it.isWsUrl)(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return void 0!==this.socket}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise(((e,t)=>{void 0!==this.socket?(this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close()):t(new Error("Connection already closed"))}))}async send(e,t){void 0===this.socket&&(this.socket=await this.register());try{this.socket.send((0,x.u)(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!(0,it.isWsUrl)(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),void 0===this.socket)return t(new Error("WebSocket connection is missing or invalid"));e(this.socket)}))}))}return this.url=e,this.registering=!0,new Promise(((t,n)=>{const i=(0,it.isReactNative)()?void 0:{rejectUnauthorized:!(0,it.isLocalhostUrl)(e)},s=new ot(e,[],i);"undefined"!=typeof WebSocket||void 0!==r.g&&void 0!==r.g.WebSocket||"undefined"!=typeof window&&void 0!==window.WebSocket||"undefined"!=typeof self&&void 0!==self.WebSocket?s.onerror=e=>{const t=e;n(this.emitError(t.error))}:s.on("error",(e=>{n(this.emitError(e))})),s.onopen=()=>{this.onOpen(s),t(s)}}))}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(void 0===e.data)return;const t="string"==typeof e.data?(0,x.D)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const r=this.parseError(t),n=r.message||r.toString(),i=(0,it.formatJsonRpcError)(e,n);this.events.emit("payload",i)}parseError(e,t=this.url){return(0,it.parseConnectionError)(e,st(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(e){const t=this.parseError(new Error((null==e?void 0:e.message)||`WebSocket connection failed for host: ${st(this.url)}`));return this.events.emit("register_error",t),t}};var ct=r(72307),ut=r.n(ct),ht=r(34155),lt=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,o=new Uint8Array(s);e[t];){var h=r[e.charCodeAt(t)];if(255===h)return;for(var l=0,p=s-1;(0!==h||l>>0,o[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=l,t++}if(" "!==e[t]){for(var d=s-i;d!==s&&0===o[d];)d++;for(var f=new Uint8Array(n+(s-d)),g=n;d!==s;)f[g++]=o[d++];return f}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,s=t.length;i!==s&&0===t[i];)i++,r++;for(var o=(s-i)*h+1>>>0,u=new Uint8Array(o);i!==s;){for(var l=t[i],p=0,d=o-1;(0!==l||p>>0,u[d]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");n=p,i++}for(var f=o-n;f!==o&&0===u[f];)f++;for(var g=c.repeat(r);f{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};class dt{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class ft{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return yt(this,e)}}class gt{constructor(e){this.decoders=e}or(e){return yt(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const yt=(e,t)=>new gt({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class mt{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new dt(e,t,r),this.decoder=new ft(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const vt=({name:e,prefix:t,encode:r,decode:n})=>new mt(e,t,r,n),wt=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:i}=lt(r,t);return vt({prefix:e,name:t,encode:n,decode:e=>pt(i(e))})},bt=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>vt({prefix:t,name:e,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<r;)o-=r,s+=t[i&a>>o];if(o&&(s+=t[i&a<((e,t,r,n)=>{const i={};for(let e=0;e=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o})(t,n,r,e)}),_t=vt({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)});var Et=Object.freeze({__proto__:null,identity:_t});const It=bt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var St=Object.freeze({__proto__:null,base2:It});const Pt=bt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ot=Object.freeze({__proto__:null,base8:Pt});const Nt=wt({prefix:"9",name:"base10",alphabet:"0123456789"});var Rt=Object.freeze({__proto__:null,base10:Nt});const Ct=bt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),xt=bt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Tt=Object.freeze({__proto__:null,base16:Ct,base16upper:xt});const At=bt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),jt=bt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Dt=bt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ut=bt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),kt=bt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$t=bt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),qt=bt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Lt=bt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Mt=bt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var zt=Object.freeze({__proto__:null,base32:At,base32upper:jt,base32pad:Dt,base32padupper:Ut,base32hex:kt,base32hexupper:$t,base32hexpad:qt,base32hexpadupper:Lt,base32z:Mt});const Vt=wt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Kt=wt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Wt=Object.freeze({__proto__:null,base36:Vt,base36upper:Kt});const Ft=wt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ht=wt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Bt=Object.freeze({__proto__:null,base58btc:Ft,base58flickr:Ht});const Jt=bt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Gt=bt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Qt=bt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Yt=bt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Zt=Object.freeze({__proto__:null,base64:Jt,base64pad:Gt,base64url:Qt,base64urlpad:Yt});const Xt=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),er=Xt.reduce(((e,t,r)=>(e[r]=t,e)),[]),tr=Xt.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]),rr=vt({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+er[t]),"")},decode:function(e){const t=[];for(const r of e){const e=tr[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}});var nr=Object.freeze({__proto__:null,base256emoji:rr}),ir=128,sr=-128,or=Math.pow(2,31),ar=Math.pow(2,7),cr=Math.pow(2,14),ur=Math.pow(2,21),hr=Math.pow(2,28),lr=Math.pow(2,35),pr=Math.pow(2,42),dr=Math.pow(2,49),fr=Math.pow(2,56),gr=Math.pow(2,63),yr=function e(t,r,n){r=r||[];for(var i=n=n||0;t>=or;)r[n++]=255&t|ir,t/=128;for(;t&sr;)r[n++]=255&t|ir,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},mr=function(e){return e(yr(e,t,r),t),wr=e=>mr(e),br=(e,t)=>{const r=t.byteLength,n=wr(e),i=n+wr(r),s=new Uint8Array(i+r);return vr(e,s,0),vr(r,s,n),s.set(t,i),new _r(e,r,t,s)};class _r{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}const Er=({name:e,code:t,encode:r})=>new Ir(e,t,r);class Ir{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?br(this.code,t):t.then((e=>br(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Sr=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Pr=Er({name:"sha2-256",code:18,encode:Sr("SHA-256")}),Or=Er({name:"sha2-512",code:19,encode:Sr("SHA-512")});Object.freeze({__proto__:null,sha256:Pr,sha512:Or});const Nr=pt,Rr={code:0,name:"identity",encode:Nr,digest:e=>br(0,Nr(e))};Object.freeze({__proto__:null,identity:Rr}),new TextEncoder,new TextDecoder;const Cr={...Et,...St,...Ot,...Rt,...Tt,...zt,...Wt,...Bt,...Zt,...nr};function xr(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function Tr(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const Ar=Tr("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),jr=Tr("ascii","a",(e=>{let t="a";for(let r=0;r{const t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?xr(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}((e=e.substring(1)).length);for(let r=0;r{if(!this.initialized){const e=await this.getKeyChain();typeof e<"u"&&(this.keychain=e),this.initialized=!0}},this.has=e=>(this.isInitialized(),this.keychain.has(e)),this.set=async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()},this.get=e=>{this.isInitialized();const t=this.keychain.get(e);if(typeof t>"u"){const{message:t}=ze("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t},this.del=async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()},this.core=e,this.logger=(0,m.generateChildLogger)(t,this.name)}get context(){return(0,m.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,be(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?_e(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ze("NOT_INITIALIZED",this.name);throw new Error(e)}}}class dn{constructor(e,t,r){this.core=e,this.logger=t,this.name="crypto",this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=e=>(this.isInitialized(),this.keychain.has(e)),this.getClientId=async()=>{this.isInitialized();const e=await this.getClientSeed(),t=T.generateKeyPair(e);return T.encodeIss(t.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const e=function(){const e=u.Au();return{privateKey:(0,h.BB)(e.secretKey,Q),publicKey:(0,h.BB)(e.publicKey,Q)}}();return this.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=async e=>{this.isInitialized();const t=await this.getClientSeed(),r=T.generateKeyPair(t),n=X(),i=Lr;return await T.signJWT(n,e,i,r)},this.generateSharedKey=(e,t,r)=>{this.isInitialized();const n=function(e,t){const r=u.gi((0,h.mL)(e,Q),(0,h.mL)(t,Q)),n=new o.t(c.mE,r).expand(32);return(0,h.BB)(n,Q)}(this.getPrivateKey(e),t);return this.setSymKey(n,r)},this.setSymKey=async(e,t)=>{this.isInitialized();const r=t||function(e){const t=(0,c.vp)((0,h.mL)(e,Q));return(0,h.BB)(t,Q)}(e);return await this.keychain.set(r,e),r},this.deleteKeyPair=async e=>{this.isInitialized(),await this.keychain.del(e)},this.deleteSymKey=async e=>{this.isInitialized(),await this.keychain.del(e)},this.encode=async(e,t,r)=>{this.isInitialized();const n=ne(r),i=(0,x.u)(t);if(ie(n)){const t=n.senderPublicKey,r=n.receiverPublicKey;e=await this.generateSharedKey(t,r)}const o=this.getSymKey(e),{type:c,senderPublicKey:u}=n;return function(e){const t=function(e){return(0,h.mL)(`${e}`,G)}(typeof e.type<"u"?e.type:0);if(1===te(t)&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof e.senderPublicKey<"u"?(0,h.mL)(e.senderPublicKey,Q):void 0,n=typeof e.iv<"u"?(0,h.mL)(e.iv,Q):(0,a.randomBytes)(12);return function(e){if(1===te(e.type)){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return(0,h.BB)((0,h.zo)([e.type,e.senderPublicKey,e.iv,e.sealed]),Y)}return(0,h.BB)((0,h.zo)([e.type,e.iv,e.sealed]),Y)}({type:t,sealed:new s.OK((0,h.mL)(e.symKey,Q)).seal(n,(0,h.mL)(e.message,Z)),iv:n,senderPublicKey:r})}({type:c,symKey:o,message:i,senderPublicKey:u})},this.decode=async(e,t,r)=>{this.isInitialized();const n=function(e,t){const r=re(e);return ne({type:te(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?(0,h.BB)(r.senderPublicKey,Q):void 0,receiverPublicKey:t?.receiverPublicKey})}(t,r);if(ie(n)){const t=n.receiverPublicKey,r=n.senderPublicKey;e=await this.generateSharedKey(t,r)}try{const r=function(e){const t=new s.OK((0,h.mL)(e.symKey,Q)),{sealed:r,iv:n}=re(e.encoded),i=t.open(n,r);if(null===i)throw new Error("Failed to decrypt");return(0,h.BB)(i,Z)}({symKey:this.getSymKey(e),encoded:t});return(0,x.D)(r)}catch(t){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(t)}},this.getPayloadType=e=>te(re(e).type),this.getPayloadSenderPublicKey=e=>{const t=re(e);return t.senderPublicKey?(0,h.BB)(t.senderPublicKey,Q):void 0},this.core=e,this.logger=(0,m.generateChildLogger)(t,this.name),this.keychain=r||new pn(this.core,this.logger)}get context(){return(0,m.getLoggerContext)(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(qr)}catch{e=X(),await this.keychain.set(qr,e)}return function(e,t="utf8"){const r=Dr[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${e}`):xr(globalThis.Buffer.from(e,"utf-8"))}(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ze("NOT_INITIALIZED",this.name);throw new Error(e)}}}class fn extends _{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name="messages",this.version="0.3",this.initialized=!1,this.storagePrefix=kr,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const e=await this.getRelayerMessages();typeof e<"u"&&(this.messages=e),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}},this.set=async(e,t)=>{this.isInitialized();const r=ee(t);let n=this.messages.get(e);return typeof n>"u"&&(n={}),typeof n[r]<"u"||(n[r]=t,this.messages.set(e,n),await this.persist()),r},this.get=e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t},this.has=(e,t)=>(this.isInitialized(),typeof this.get(e)[ee(t)]<"u"),this.del=async e=>{this.isInitialized(),this.messages.delete(e),await this.persist()},this.logger=(0,m.generateChildLogger)(e,this.name),this.core=t}get context(){return(0,m.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,be(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?_e(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ze("NOT_INITIALIZED",this.name);throw new Error(e)}}}class gn extends E{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new n.EventEmitter,this.name="publisher",this.queue=new Map,this.publishTimeout=(0,l.toMiliseconds)(l.TEN_SECONDS),this.queueTimeout=(0,l.toMiliseconds)(l.FIVE_SECONDS),this.needsTransportRestart=!1,this.publish=async(e,t,r)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});try{const n=r?.ttl||Mr,i=Ce(r),s=r?.prompt||!1,o=r?.tag||0,a=r?.id||(0,it.getBigIntRpcId)().toString(),c={topic:e,message:t,opts:{ttl:n,relay:i,prompt:s,tag:o,id:a}},u=setTimeout((()=>this.queue.set(a,c)),this.queueTimeout);try{await await Ie(this.rpcPublish(e,t,n,i,s,o,a),this.publishTimeout),clearTimeout(u),this.relayer.events.emit(Gr,c)}catch{return this.logger.debug("Publishing Payload stalled"),void(this.needsTransportRestart=!0)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}})}catch(e){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(e),e}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.relayer=e,this.logger=(0,m.generateChildLogger)(t,this.name),this.registerEventListeners()}get context(){return(0,m.getLoggerContext)(this.logger)}rpcPublish(e,t,r,n,i,s,o){var a,c,u,h;const l={method:xe(n.protocol).publish,params:{topic:e,message:t,ttl:r,prompt:i,tag:s},id:o};return Fe(null==(a=l.params)?void 0:a.prompt)&&(null==(c=l.params)||delete c.prompt),Fe(null==(u=l.params)?void 0:u.tag)&&(null==(h=l.params)||delete h.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:l}),this.relayer.request(l)}onPublish(e){this.queue.delete(e)}checkQueue(){this.queue.forEach((async e=>{const{topic:t,message:r,opts:n}=e;await this.publish(t,r,n)}))}registerEventListeners(){this.relayer.core.heartbeat.on(y.HEARTBEAT_EVENTS.pulse,(()=>{if(this.needsTransportRestart)return this.needsTransportRestart=!1,void this.relayer.events.emit(Br);this.checkQueue()})),this.relayer.on(Wr,(e=>{this.onPublish(e.id.toString())}))}}class yn{constructor(){this.map=new Map,this.set=(e,t)=>{const r=this.get(e);this.exists(e,t)||this.map.set(e,[...r,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u")return void this.map.delete(e);if(!this.map.has(e))return;const r=this.get(e);if(!this.exists(e,t))return;const n=r.filter((e=>e!==t));n.length?this.map.set(e,n):this.map.delete(e)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var mn=Object.defineProperty,vn=Object.defineProperties,wn=Object.getOwnPropertyDescriptors,bn=Object.getOwnPropertySymbols,_n=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable,In=(e,t,r)=>t in e?mn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Sn=(e,t)=>{for(var r in t||(t={}))_n.call(t,r)&&In(e,r,t[r]);if(bn)for(var r of bn(t))En.call(t,r)&&In(e,r,t[r]);return e},Pn=(e,t)=>vn(e,wn(t));class On extends P{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new yn,this.events=new n.EventEmitter,this.name="subscription",this.version="0.3",this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=kr,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{const r=Ce(t),n={topic:e,relay:r};this.pending.set(e,n);const i=await this.rpcSubscribe(e,r);return this.onSubscribe(i,n),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}}),i}catch(e){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(e),e}},this.unsubscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),typeof t?.id<"u"?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)},this.isSubscribed=async e=>!!this.topics.includes(e)||await new Promise(((t,r)=>{const n=new l.Watch;n.start(this.pendingSubscriptionWatchLabel);const i=setInterval((()=>{!this.pending.has(e)&&this.topics.includes(e)&&(clearInterval(i),n.stop(this.pendingSubscriptionWatchLabel),t(!0)),n.elapsed(this.pendingSubscriptionWatchLabel)>=tn&&(clearInterval(i),n.stop(this.pendingSubscriptionWatchLabel),r(new Error("Subscription resolution timeout")))}),this.pollingInterval)})).catch((()=>!1)),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=(0,m.generateChildLogger)(t,this.name),this.clientId=""}get context(){return(0,m.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let r=!1;try{r=this.getSubscription(e).topic===t}catch{}return r}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const r=this.topicMap.get(e);await Promise.all(r.map((async r=>await this.unsubscribeById(e,r,t))))}async unsubscribeById(e,t,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}});try{const n=Ce(r);await this.rpcUnsubscribe(e,t,n);const i=Ve("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,i),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}})}catch(e){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(e),e}}async rpcSubscribe(e,t){const r={method:xe(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{await await Ie(this.relayer.request(r),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Br)}return ee(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;const t={method:xe(e[0].relay.protocol).batchSubscribe,params:{topics:e.map((e=>e.topic))}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{return await await Ie(this.relayer.request(t),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Br)}}rpcUnsubscribe(e,t,r){const n={method:xe(r.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,t){this.setSubscription(e,Pn(Sn({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach((e=>{this.setSubscription(e.id,Sn({},e)),this.pending.delete(e.topic)}))}async onUnsubscribe(e,t,r){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,r),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,Sn({},t)),this.topicMap.set(t.topic,e),this.events.emit(Zr,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:t}=ze("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const r=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(Xr,Pn(Sn({},r),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit("subscription_sync")}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t"u"||!e.length)return;if(this.subscriptions.size){const{message:e}=ze("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);Ke(t)&&this.onBatchSubscribe(t.map(((t,r)=>Pn(Sn({},e[r]),{id:t}))))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(this.relayer.transportExplicitlyClosed)return;const e=[];this.pending.forEach((t=>{e.push(t)})),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(y.HEARTBEAT_EVENTS.pulse,(async()=>{await this.checkPending()})),this.relayer.on(Fr,(async()=>{await this.onConnect()})),this.relayer.on(Hr,(()=>{this.onDisconnect()})),this.events.on(Zr,(async e=>{const t=Zr;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})),this.events.on(Xr,(async e=>{const t=Xr;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=ze("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise((e=>{const t=setInterval((()=>{this.restartInProgress||(clearInterval(t),e())}),this.pollingInterval)}))}}var Nn=Object.defineProperty,Rn=Object.getOwnPropertySymbols,Cn=Object.prototype.hasOwnProperty,xn=Object.prototype.propertyIsEnumerable,Tn=(e,t,r)=>t in e?Nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;class An extends I{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new n.EventEmitter,this.name="relayer",this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.request=async e=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(e)}catch(e){throw this.logger.debug("Failed to Publish Request"),this.logger.error(e),e}},this.core=e.core,this.logger=typeof e.logger<"u"&&"string"!=typeof e.logger?(0,m.generateChildLogger)(e.logger,this.name):(0,m.pino)((0,m.getDefaultLoggerOptions)({level:e.logger||"error"})),this.messages=new fn(this.logger,e.core),this.subscriber=new On(this,this.logger),this.publisher=new gn(this,this.logger),this.relayUrl=e?.relayUrl||zr,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${Vr}...`),await this.restartTransport(Vr)}this.registerEventListeners(),this.initialized=!0,setTimeout((async()=>{0===this.subscriber.topics.length&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)}),1e4)}get context(){return(0,m.getLoggerContext)(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,r){this.isInitialized(),await this.publisher.publish(e,t,r),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()})}async subscribe(e,t){var r;this.isInitialized();let n=(null==(r=this.subscriber.topicMap.get(e))?void 0:r[0])||"";return n||(await Promise.all([new Promise((t=>{this.subscriber.once(Zr,(r=>{r.topic===e&&t()}))})),new Promise((async r=>{n=await this.subscriber.subscribe(e,t),r()}))]),n)}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(Jr))}async transportOpen(e){if(this.transportExplicitlyClosed=!1,!this.reconnecting){this.relayUrl=e||this.relayUrl,this.reconnecting=!0;try{await Promise.all([new Promise((e=>{this.initialized||e(),this.subscriber.once(en,(()=>{e()}))})),await Promise.race([new Promise((async(e,t)=>{await Ie(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`).catch((e=>t(e))).then((()=>e())).finally((()=>this.removeListener(Jr,this.rejectTransportOpen)))})),new Promise((e=>this.once(Jr,this.rejectTransportOpen)))])])}catch(e){this.logger.error(e);const t=e;if(!this.isConnectionStalled(t.message))throw e;this.events.emit(Jr)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||this.reconnecting||(this.relayUrl=e||this.relayUrl,this.connected&&await Promise.all([new Promise((e=>{this.provider.once(Qr,(()=>{e()}))})),this.transportClose()]),await this.createProvider(),await this.transportOpen())}isConnectionStalled(e){return this.staleConnectionErrors.some((t=>e.includes(t)))}rejectTransportOpen(){throw new Error("Attempt to connect to relay via `transportOpen` has stalled. Retrying...")}async createProvider(){const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new nt.r(new at(function({protocol:e,version:t,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){const a=r.split("?"),c={auth:i,ua:ve(e,t,n),projectId:s,useOnCloseEvent:o||void 0},u=function(e,t){let r=H.parse(e);return r=he(he({},r),t),H.stringify(r)}(a[1]||"",c);return a[0]+"?"+u}({sdkVersion:"2.9.1",protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:r}=e;await this.messages.set(t,r)}async shouldIgnoreMessageEvent(e){const{topic:t,message:r}=e;if(!r||0===r.length)return this.logger.debug(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const n=this.messages.has(t,r);return n&&this.logger.debug(`Ignoring duplicate message: ${r}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),(0,it.isJsonRpcRequest)(e)){if(!e.method.endsWith("_subscription"))return;const t=e.params,{topic:r,message:n,publishedAt:i}=t.data,s={topic:r,message:n,publishedAt:i};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(((e,t)=>{for(var r in t||(t={}))Cn.call(t,r)&&Tn(e,r,t[r]);if(Rn)for(var r of Rn(t))xn.call(t,r)&&Tn(e,r,t[r]);return e})({type:"event",event:t.id},s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}else(0,it.isJsonRpcResponse)(e)&&this.events.emit(Wr,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Kr,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=(0,it.formatJsonRpcResult)(e.id,!0);await this.provider.connection.send(t)}registerProviderListeners(){this.provider.on("payload",(e=>this.onProviderPayload(e))),this.provider.on("connect",(()=>{this.events.emit(Fr)})),this.provider.on(Qr,(()=>{this.onProviderDisconnect()})),this.provider.on("error",(e=>{this.logger.error(e),this.events.emit("relayer_error",e)}))}registerEventListeners(){this.events.on(Br,(async()=>{await this.restartTransport()}))}onProviderDisconnect(){this.events.emit(Hr),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout((async()=>{await this.restartTransport()}),(0,l.toMiliseconds)(Yr))}isInitialized(){if(!this.initialized){const{message:e}=ze("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(!this.connected){if(this.connecting)return await new Promise((e=>{const t=setInterval((()=>{this.connected&&(clearInterval(t),e())}),this.connectionStatusPollingInterval)}));await this.restartTransport()}}}var jn=Object.defineProperty,Dn=Object.getOwnPropertySymbols,Un=Object.prototype.hasOwnProperty,kn=Object.prototype.propertyIsEnumerable,$n=(e,t,r)=>t in e?jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,qn=(e,t)=>{for(var r in t||(t={}))Un.call(t,r)&&$n(e,r,t[r]);if(Dn)for(var r of Dn(t))kn.call(t,r)&&$n(e,r,t[r]);return e};class Ln extends S{constructor(e,t,r,n=kr,i=void 0){super(e,t,r,n),this.core=e,this.logger=t,this.name=r,this.map=new Map,this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=kr,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>{this.getKey&&null!==e&&!Fe(e)?this.map.set(this.getKey(e),e):function(e){var t;return null==(t=e?.proposer)?void 0:t.publicKey}(e)?this.map.set(e.id,e):function(e){return e?.topic}(e)&&this.map.set(e.topic,e)})),this.cached=[],this.initialized=!0)},this.set=async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())},this.get=e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e)),this.getAll=e=>(this.isInitialized(),e?this.values.filter((t=>Object.keys(e).every((r=>ut()(t[r],e[r]))))):this.values),this.update=async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});const r=qn(qn({},this.getData(e)),t);this.map.set(e,r),await this.persist()},this.delete=async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),await this.persist())},this.logger=(0,m.generateChildLogger)(t,this.name),this.storagePrefix=n,this.getKey=i}get context(){return(0,m.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){const{message:t}=ze("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:e}=ze("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ze("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Mn{constructor(e,t){this.core=e,this.logger=t,this.name="pairing",this.version="0.3",this.events=new(i()),this.initialized=!1,this.storagePrefix=kr,this.ignoredPayloadTypes=[1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]},this.create=async()=>{this.isInitialized();const e=X(),t=await this.core.crypto.setSymKey(e),r=Oe(l.FIVE_MINUTES),n={protocol:"irn"},i={topic:t,expiry:r,relay:n,active:!1},s=function(e){return`${e.protocol}:${e.topic}@${e.version}?`+H.stringify(((e,t)=>{for(var r in t||(t={}))je.call(t,r)&&Ue(e,r,t[r]);if(Ae)for(var r of Ae(t))De.call(t,r)&&Ue(e,r,t[r]);return e})({symKey:e.symKey},function(e,t="-"){const r={};return Object.keys(e).forEach((n=>{const i="relay"+t+n;e[n]&&(r[i]=e[n])})),r}(e.relay)))}({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:e,relay:n});return await this.pairings.set(t,i),await this.core.relayer.subscribe(t),this.core.expirer.set(t,r),{topic:t,uri:s}},this.pair=async e=>{this.isInitialized(),this.isValidPair(e);const{topic:t,symKey:r,relay:n}=function(e){const t=e.indexOf(":"),r=-1!==e.indexOf("?")?e.indexOf("?"):void 0,n=e.substring(0,t),i=e.substring(t+1,r).split("@"),s=typeof r<"u"?e.substring(r):"",o=H.parse(s);return{protocol:n,topic:$e(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:ke(o)}}(e.uri);if(this.pairings.keys.includes(t))throw new Error(`Pairing already exists: ${t}`);if(this.core.crypto.hasKeys(t))throw new Error(`Keychain already exists: ${t}`);const i=Oe(l.FIVE_MINUTES),s={topic:t,relay:n,expiry:i,active:!1};return await this.pairings.set(t,s),await this.core.crypto.setSymKey(r,t),await this.core.relayer.subscribe(t,{relay:n}),this.core.expirer.set(t,i),e.activatePairing&&await this.activate({topic:t}),s},this.activate=async({topic:e})=>{this.isInitialized();const t=Oe(l.THIRTY_DAYS);await this.pairings.update(e,{active:!0,expiry:t}),this.core.expirer.set(e,t)},this.ping=async e=>{this.isInitialized(),await this.isValidPing(e);const{topic:t}=e;if(this.pairings.keys.includes(t)){const e=await this.sendRequest(t,"wc_pairingPing",{}),{done:r,resolve:n,reject:i}=Ee();this.events.once(Re("pairing_ping",e),(({error:e})=>{e?i(e):n()})),await r()}},this.updateExpiry=async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})},this.updateMetadata=async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async e=>{this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",Ve("USER_DISCONNECTED")),await this.deletePairing(t))},this.sendRequest=async(e,t,r)=>{const n=(0,it.formatJsonRpcRequest)(t,r),i=await this.core.crypto.encode(e,n),s=rn[t].req;return this.core.history.set(e,n),this.core.relayer.publish(e,i,s),n.id},this.sendResult=async(e,t,r)=>{const n=(0,it.formatJsonRpcResult)(e,r),i=await this.core.crypto.encode(t,n),s=await this.core.history.get(t,e),o=rn[s.request.method].res;await this.core.relayer.publish(t,i,o),await this.core.history.resolve(n)},this.sendError=async(e,t,r)=>{const n=(0,it.formatJsonRpcError)(e,r),i=await this.core.crypto.encode(t,n),s=await this.core.history.get(t,e),o=rn[s.request.method]?rn[s.request.method].res:rn.unregistered_method.res;await this.core.relayer.publish(t,i,o),await this.core.history.resolve(n)},this.deletePairing=async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,Ve("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])},this.cleanup=async()=>{const e=this.pairings.getAll().filter((e=>Ne(e.expiry)));await Promise.all(e.map((e=>this.deletePairing(e.topic))))},this.onRelayEventRequest=e=>{const{topic:t,payload:r}=e;switch(r.method){case"wc_pairingPing":return this.onPairingPingRequest(t,r);case"wc_pairingDelete":return this.onPairingDeleteRequest(t,r);default:return this.onUnknownRpcMethodRequest(t,r)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:r}=e,n=(await this.core.history.get(t,r.id)).request.method;return"wc_pairingPing"===n?this.onPairingPingResponse(t,r):this.onUnknownRpcMethodResponse(n)},this.onPairingPingRequest=async(e,t)=>{const{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult(r,e,!0),this.events.emit("pairing_ping",{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}},this.onPairingPingResponse=(e,t)=>{const{id:r}=t;setTimeout((()=>{(0,it.isJsonRpcResult)(t)?this.events.emit(Re("pairing_ping",r),{}):(0,it.isJsonRpcError)(t)&&this.events.emit(Re("pairing_ping",r),{error:t.error})}),500)},this.onPairingDeleteRequest=async(e,t)=>{const{id:r}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit("pairing_delete",{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}},this.onUnknownRpcMethodRequest=async(e,t)=>{const{id:r,method:n}=t;try{if(this.registeredMethods.includes(n))return;const t=Ve("WC_METHOD_UNSUPPORTED",n);await this.sendError(r,e,t),this.logger.error(t)}catch(t){await this.sendError(r,e,t),this.logger.error(t)}},this.onUnknownRpcMethodResponse=e=>{this.registeredMethods.includes(e)||this.logger.error(Ve("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`pair() params: ${e}`);throw new Error(t)}if(!function(e){if(He(e,!1))try{return typeof new URL(e)<"u"}catch{return!1}return!1}(e.uri)){const{message:t}=ze("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw new Error(t)}},this.isValidPing=async e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidDisconnect=async e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidPairingTopic=async e=>{if(!He(e,!1)){const{message:t}=ze("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.pairings.keys.includes(e)){const{message:t}=ze("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Ne(this.pairings.get(e).expiry)){await this.deletePairing(e);const{message:t}=ze("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}},this.core=e,this.logger=(0,m.generateChildLogger)(t,this.name),this.pairings=new Ln(this.core,this.logger,this.name,this.storagePrefix)}get context(){return(0,m.getLoggerContext)(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ze("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Kr,(async e=>{const{topic:t,message:r}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))return;const n=await this.core.crypto.decode(t,r);(0,it.isJsonRpcRequest)(n)?(this.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):(0,it.isJsonRpcResponse)(n)&&(await this.core.history.resolve(n),await this.onRelayEventResponse({topic:t,payload:n}),this.core.history.delete(t,n.id))}))}registerExpirerEvents(){this.core.expirer.on(un,(async e=>{const{topic:t}=Pe(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit("pairing_expire",{topic:t}))}))}}class zn extends b{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new n.EventEmitter,this.name="history",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=kr,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.records.set(e.id,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(e,t,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:r}),this.records.has(t.id))return;const n={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:r,expiry:Oe(l.THIRTY_DAYS)};this.records.set(n.id,n),this.events.emit(nn,n)},this.resolve=async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;const t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=(0,it.isJsonRpcError)(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.events.emit(sn,t))},this.get=async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t)),this.delete=(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach((r=>{if(r.topic===e){if(typeof t<"u"&&r.id!==t)return;this.records.delete(r.id),this.events.emit(on,r)}}))},this.exists=async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=(0,m.generateChildLogger)(t,this.name)}get context(){return(0,m.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach((t=>{if(typeof t.response<"u")return;const r={topic:t.topic,request:(0,it.formatJsonRpcRequest)(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(r)})),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:t}=ze("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit("history_sync")}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:e}=ze("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(nn,(e=>{const t=nn;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})),this.events.on(sn,(e=>{const t=sn;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})),this.events.on(on,(e=>{const t=on;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})),this.core.heartbeat.on(y.HEARTBEAT_EVENTS.pulse,(()=>{this.cleanup()}))}cleanup(){try{this.records.forEach((e=>{(0,l.toMiliseconds)(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))}))}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ze("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Vn extends O{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new n.EventEmitter,this.name="expirer",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=kr,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.expirations.set(e.target,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=e=>{try{const t=this.formatTarget(e);return typeof this.getExpiration(t)<"u"}catch{return!1}},this.set=(e,t)=>{this.isInitialized();const r=this.formatTarget(e),n={target:r,expiry:t};this.expirations.set(r,n),this.checkExpiry(r,n),this.events.emit(an,{target:r,expiration:n})},this.get=e=>{this.isInitialized();const t=this.formatTarget(e);return this.getExpiration(t)},this.del=e=>{if(this.isInitialized(),this.has(e)){const t=this.formatTarget(e),r=this.getExpiration(t);this.expirations.delete(t),this.events.emit(cn,{target:t,expiration:r})}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=(0,m.generateChildLogger)(t,this.name)}get context(){return(0,m.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return function(e){return Se("topic",e)}(e);if("number"==typeof e)return function(e){return Se("id",e)}(e);const{message:t}=ze("UNKNOWN_TYPE","Target type: "+typeof e);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit("expirer_sync")}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:e}=ze("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:t}=ze("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}checkExpiry(e,t){const{expiry:r}=t;(0,l.toMiliseconds)(r)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(un,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach(((e,t)=>this.checkExpiry(t,e)))}registerEventListeners(){this.core.heartbeat.on(y.HEARTBEAT_EVENTS.pulse,(()=>this.checkExpirations())),this.events.on(an,(e=>{const t=an;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(un,(e=>{const t=un;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(cn,(e=>{const t=cn;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=ze("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Kn extends N{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=hn,this.initialized=!1,this.init=async e=>{ge()||!ye()||(this.verifyUrl=e?.verifyUrl||ln,await this.createIframe())},this.register=async e=>{var t;if(this.initialized||await this.init(),this.iframe)try{null==(t=this.iframe.contentWindow)||t.postMessage(e.attestationId,this.verifyUrl),this.logger.info(`postMessage sent: ${e.attestationId} ${this.verifyUrl}`)}catch{}},this.resolve=async e=>{var t;if(this.isDevEnv)return"";this.logger.info(`resolving attestation: ${e.attestationId}`);const r=this.startAbortTimer(l.FIVE_SECONDS),n=await fetch(`${this.verifyUrl}/attestation/${e.attestationId}`,{signal:this.abortController.signal});return clearTimeout(r),200===n.status?null==(t=await n.json())?void 0:t.origin:""},this.createIframe=async()=>{try{await Promise.race([new Promise(((e,t)=>{if(document.getElementById(hn))return e();const r=document.createElement("iframe");r.setAttribute("id",hn),r.setAttribute("src",`${this.verifyUrl}/${this.projectId}`),r.style.display="none",r.addEventListener("load",(()=>{this.initialized=!0,e()})),r.addEventListener("error",(e=>{t(e)})),document.body.append(r),this.iframe=r})),new Promise((e=>{setTimeout((()=>e("iframe load timeout")),(0,l.toMiliseconds)(l.ONE_SECOND/2))}))])}catch(e){this.logger.error(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.error(e)}},this.logger=(0,m.generateChildLogger)(t,this.name),this.verifyUrl=ln,this.abortController=new AbortController,this.isDevEnv=fe()&&ht.env.IS_VITEST}get context(){return(0,m.getLoggerContext)(this.logger)}startAbortTimer(e){return setTimeout((()=>this.abortController.abort()),(0,l.toMiliseconds)(e))}}var Wn=Object.defineProperty,Fn=Object.getOwnPropertySymbols,Hn=Object.prototype.hasOwnProperty,Bn=Object.prototype.propertyIsEnumerable,Jn=(e,t,r)=>t in e?Wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Gn=(e,t)=>{for(var r in t||(t={}))Hn.call(t,r)&&Jn(e,r,t[r]);if(Fn)for(var r of Fn(t))Bn.call(t,r)&&Jn(e,r,t[r]);return e};class Qn extends w{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=Ur,this.events=new n.EventEmitter,this.initialized=!1,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||zr;const t=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:(0,m.pino)((0,m.getDefaultLoggerOptions)({level:e?.logger||"error"}));this.logger=(0,m.generateChildLogger)(t,this.name),this.heartbeat=new y.HeartBeat,this.crypto=new dn(this,this.logger,e?.keychain),this.history=new zn(this,this.logger),this.expirer=new Vn(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new g.Z(Gn(Gn({},$r),e?.storageOptions)),this.relayer=new An({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Mn(this,this.logger),this.verify=new Kn(this.projectId||"",this.logger)}static async init(e){const t=new Qn(e);await t.initialize();const r=await t.crypto.getClientId();return await t.storage.setItem("WALLETCONNECT_CLIENT_ID",r),t}get context(){return(0,m.getLoggerContext)(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const Yn=Qn,Zn="client",Xn=`wc@2:${Zn}:`,ei=Zn,ti="Proposal expired",ri=l.SEVEN_DAYS,ni={wc_sessionPropose:{req:{ttl:l.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:l.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:l.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:l.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:l.ONE_DAY,prompt:!1,tag:1104},res:{ttl:l.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:l.ONE_DAY,prompt:!1,tag:1106},res:{ttl:l.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:l.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:l.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:l.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:l.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:l.ONE_DAY,prompt:!1,tag:1112},res:{ttl:l.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:l.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:l.THIRTY_SECONDS,prompt:!1,tag:1115}}},ii={min:l.FIVE_MINUTES,max:l.SEVEN_DAYS},si="idle",oi="active",ai=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var ci=Object.defineProperty,ui=Object.defineProperties,hi=Object.getOwnPropertyDescriptors,li=Object.getOwnPropertySymbols,pi=Object.prototype.hasOwnProperty,di=Object.prototype.propertyIsEnumerable,fi=(e,t,r)=>t in e?ci(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gi=(e,t)=>{for(var r in t||(t={}))pi.call(t,r)&&fi(e,r,t[r]);if(li)for(var r of li(t))di.call(t,r)&&fi(e,r,t[r]);return e},yi=(e,t)=>ui(e,hi(t));class mi extends C{constructor(e){super(e),this.name="engine",this.events=new(i()),this.initialized=!1,this.ignoredPayloadTypes=[1],this.requestQueue={state:si,requests:[]},this.requestQueueDelay=l.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(ni)}),this.initialized=!0,setTimeout((()=>{this.requestQueue.requests=this.getPendingSessionRequests(),this.processRequestQueue()}),(0,l.toMiliseconds)(this.requestQueueDelay)))},this.connect=async e=>{this.isInitialized();const t=yi(gi({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);const{pairingTopic:r,requiredNamespaces:n,optionalNamespaces:i,sessionProperties:s,relays:o}=t;let a,c=r,u=!1;if(c&&(u=this.client.core.pairing.pairings.get(c).active),!c||!u){const{topic:e,uri:t}=await this.client.core.pairing.create();c=e,a=t}const h=await this.client.core.crypto.generateKeyPair(),p=gi({requiredNamespaces:n,optionalNamespaces:i,relays:o??[{protocol:"irn"}],proposer:{publicKey:h,metadata:this.client.metadata}},s&&{sessionProperties:s}),{reject:d,resolve:f,done:g}=Ee(l.FIVE_MINUTES,ti);if(this.events.once(Re("session_connect"),(async({error:e,session:t})=>{if(e)d(e);else if(t){t.self.publicKey=h;const e=yi(gi({},t),{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces});await this.client.session.set(t.topic,e),await this.setExpiry(t.topic,t.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:t.peer.metadata}),f(e)}})),!c){const{message:e}=ze("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(e)}const y=await this.sendRequest(c,"wc_sessionPropose",p),m=Oe(l.FIVE_MINUTES);return await this.setProposal(y,gi({id:y,expiry:m},p)),{uri:a,approval:g}},this.pair=async e=>(this.isInitialized(),await this.client.core.pairing.pair(e)),this.approve=async e=>{this.isInitialized(),await this.isValidApprove(e);const{id:t,relayProtocol:r,namespaces:n,sessionProperties:i}=e,s=this.client.proposal.get(t);let{pairingTopic:o,proposer:a,requiredNamespaces:c,optionalNamespaces:u}=s;o=o||"",We(c)||(c=function(e,t){const r=Ye(e,"approve()");if(r)throw new Error(r.message);const n={};for(const[t,r]of Object.entries(e))n[t]={methods:r.methods,events:r.events,chains:r.accounts.map((e=>`${e.split(":")[0]}:${e.split(":")[1]}`))};return n}(n));const h=await this.client.core.crypto.generateKeyPair(),l=a.publicKey,p=await this.client.core.crypto.generateSharedKey(h,l);o&&t&&(await this.client.core.pairing.updateMetadata({topic:o,metadata:a.metadata}),await this.sendResult(t,o,{relay:{protocol:r??"irn"},responderPublicKey:h}),await this.client.proposal.delete(t,Ve("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:o}));const d=gi({relay:{protocol:r??"irn"},namespaces:n,requiredNamespaces:c,optionalNamespaces:u,pairingTopic:o,controller:{publicKey:h,metadata:this.client.metadata},expiry:Oe(ri)},i&&{sessionProperties:i});await this.client.core.relayer.subscribe(p),await this.sendRequest(p,"wc_sessionSettle",d);const f=yi(gi({},d),{topic:p,pairingTopic:o,acknowledged:!1,self:d.controller,peer:{publicKey:a.publicKey,metadata:a.metadata},controller:h});return await this.client.session.set(p,f),await this.setExpiry(p,Oe(ri)),{topic:p,acknowledged:()=>new Promise((e=>setTimeout((()=>e(this.client.session.get(p))),500)))}},this.reject=async e=>{this.isInitialized(),await this.isValidReject(e);const{id:t,reason:r}=e,{pairingTopic:n}=this.client.proposal.get(t);n&&(await this.sendError(t,n,r),await this.client.proposal.delete(t,Ve("USER_DISCONNECTED")))},this.update=async e=>{this.isInitialized(),await this.isValidUpdate(e);const{topic:t,namespaces:r}=e,n=await this.sendRequest(t,"wc_sessionUpdate",{namespaces:r}),{done:i,resolve:s,reject:o}=Ee();return this.events.once(Re("session_update",n),(({error:e})=>{e?o(e):s()})),await this.client.session.update(t,{namespaces:r}),{acknowledged:i}},this.extend=async e=>{this.isInitialized(),await this.isValidExtend(e);const{topic:t}=e,r=await this.sendRequest(t,"wc_sessionExtend",{}),{done:n,resolve:i,reject:s}=Ee();return this.events.once(Re("session_extend",r),(({error:e})=>{e?s(e):i()})),await this.setExpiry(t,Oe(ri)),{acknowledged:n}},this.request=async e=>{this.isInitialized(),await this.isValidRequest(e);const{chainId:t,request:n,topic:i,expiry:s}=e,o=await this.sendRequest(i,"wc_sessionRequest",{request:n,chainId:t},s),{done:a,resolve:c,reject:u}=Ee(s);return this.events.once(Re("session_request",o),(({error:e,result:t})=>{e?u(e):c(t)})),this.client.events.emit("session_request_sent",{topic:i,request:n,chainId:t,id:o}),async function({id:e,topic:t,wcDeepLink:n}){try{if(!n)return;const i="string"==typeof n?JSON.parse(n):n;let s=i?.href;if("string"!=typeof s)return;s.endsWith("/")&&(s=s.slice(0,-1));const o=`${s}/wc?requestId=${e}&sessionTopic=${t}`,a=me();a===pe.browser?o.startsWith("https://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,"_self","noreferrer noopener"):a===pe.reactNative&&typeof(null==r.g?void 0:r.g.Linking)<"u"&&await r.g.Linking.openURL(o)}catch(e){console.error(e)}}({id:o,topic:i,wcDeepLink:await this.client.core.storage.getItem("WALLETCONNECT_DEEPLINK_CHOICE")}),await a()},this.respond=async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:t,response:r}=e,{id:n}=r;(0,it.isJsonRpcResult)(r)?await this.sendResult(n,t,r.result):(0,it.isJsonRpcError)(r)&&await this.sendError(n,t,r.error),this.cleanupAfterResponse(e)},this.ping=async e=>{this.isInitialized(),await this.isValidPing(e);const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=await this.sendRequest(t,"wc_sessionPing",{}),{done:r,resolve:n,reject:i}=Ee();this.events.once(Re("session_ping",e),(({error:e})=>{e?i(e):n()})),await r()}else this.client.core.pairing.pairings.keys.includes(t)&&await this.client.core.pairing.ping({topic:t})},this.emit=async e=>{this.isInitialized(),await this.isValidEmit(e);const{topic:t,event:r,chainId:n}=e;await this.sendRequest(t,"wc_sessionEvent",{event:r,chainId:n})},this.disconnect=async e=>{this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=(0,it.getBigIntRpcId)().toString();let r;const n=t=>{t?.id.toString()===e&&(this.client.core.relayer.events.removeListener(Wr,n),r())};await Promise.all([new Promise((e=>{r=e,this.client.core.relayer.on(Wr,n)})),this.sendRequest(t,"wc_sessionDelete",Ve("USER_DISCONNECTED"),void 0,e)]),await this.deleteSession(t)}else await this.client.core.pairing.disconnect({topic:t})},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter((t=>function(e,t){const{requiredNamespaces:r}=t,n=Object.keys(e.namespaces),i=Object.keys(r);let s=!0;return!!we(i,n)&&(n.forEach((t=>{const{accounts:n,methods:i,events:o}=e.namespaces[t],a=qe(n),c=r[t];we(J(t,c),a)&&we(c.methods,i)&&we(c.events,o)||(s=!1)})),s)}(t,e)))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{const t=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter((r=>{var n,i;return(null==(n=r.peerMetadata)?void 0:n.url)&&(null==(i=r.peerMetadata)?void 0:i.url)===e.peer.metadata.url&&r.topic&&r.topic!==t.topic}));if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map((e=>this.client.core.pairing.disconnect({topic:e.topic})))),this.client.logger.info("Duplicate pairings clean up finished")}catch(e){this.client.logger.error(e)}},this.deleteSession=async(e,t)=>{const{self:r}=this.client.session.get(e);await this.client.core.relayer.unsubscribe(e),this.client.session.delete(e,Ve("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(r.publicKey)&&await this.client.core.crypto.deleteKeyPair(r.publicKey),this.client.core.crypto.keychain.has(e)&&await this.client.core.crypto.deleteSymKey(e),t||this.client.core.expirer.del(e)},this.deleteProposal=async(e,t)=>{await Promise.all([this.client.proposal.delete(e,Ve("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)])},this.deletePendingSessionRequest=async(e,t,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]),this.requestQueue.requests=this.requestQueue.requests.filter((t=>t.id!==e)),r&&(this.requestQueue.state=si)},this.setExpiry=async(e,t)=>{this.client.session.keys.includes(e)&&await this.client.session.update(e,{expiry:t}),this.client.core.expirer.set(e,t)},this.setProposal=async(e,t)=>{await this.client.proposal.set(e,t),this.client.core.expirer.set(e,t.expiry)},this.setPendingSessionRequest=async e=>{const t=ni.wc_sessionRequest.req.ttl,{id:r,topic:n,params:i}=e;await this.client.pendingRequest.set(r,{id:r,topic:n,params:i}),t&&this.client.core.expirer.set(r,Oe(t))},this.sendRequest=async(e,t,r,n,i)=>{const s=(0,it.formatJsonRpcRequest)(t,r);if(ye()&&ai.includes(t)){const e=ee(JSON.stringify(s));await this.client.core.verify.register({attestationId:e})}const o=await this.client.core.crypto.encode(e,s),a=ni[t].req;return n&&(a.ttl=n),i&&(a.id=i),this.client.core.history.set(e,s),this.client.core.relayer.publish(e,o,a),s.id},this.sendResult=async(e,t,r)=>{const n=(0,it.formatJsonRpcResult)(e,r),i=await this.client.core.crypto.encode(t,n),s=await this.client.core.history.get(t,e),o=ni[s.request.method].res;this.client.core.relayer.publish(t,i,o),await this.client.core.history.resolve(n)},this.sendError=async(e,t,r)=>{const n=(0,it.formatJsonRpcError)(e,r),i=await this.client.core.crypto.encode(t,n),s=await this.client.core.history.get(t,e),o=ni[s.request.method].res;this.client.core.relayer.publish(t,i,o),await this.client.core.history.resolve(n)},this.cleanup=async()=>{const e=[],t=[];this.client.session.getAll().forEach((t=>{Ne(t.expiry)&&e.push(t.topic)})),this.client.proposal.getAll().forEach((e=>{Ne(e.expiry)&&t.push(e.id)})),await Promise.all([...e.map((e=>this.deleteSession(e))),...t.map((e=>this.deleteProposal(e)))])},this.onRelayEventRequest=e=>{const{topic:t,payload:r}=e,n=r.method;switch(n){case"wc_sessionPropose":return this.onSessionProposeRequest(t,r);case"wc_sessionSettle":return this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return this.onSessionExtendRequest(t,r);case"wc_sessionPing":return this.onSessionPingRequest(t,r);case"wc_sessionDelete":return this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return this.onSessionRequest(t,r);case"wc_sessionEvent":return this.onSessionEventRequest(t,r);default:return this.client.logger.info(`Unsupported request method ${n}`)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:r}=e,n=(await this.client.core.history.get(t,r.id)).request.method;switch(n){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);default:return this.client.logger.info(`Unsupported response method ${n}`)}},this.onRelayEventUnknownPayload=e=>{const{topic:t}=e,{message:r}=ze("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw new Error(r)},this.onSessionProposeRequest=async(e,t)=>{const{params:r,id:n}=t;try{this.isValidConnect(gi({},t.params));const i=Oe(l.FIVE_MINUTES),s=gi({id:n,pairingTopic:e,expiry:i},r);await this.setProposal(n,s);const o=ee(JSON.stringify(t)),a=await this.getVerifyContext(o,s.proposer.metadata);this.client.events.emit("session_proposal",{id:n,params:s,verifyContext:a})}catch(t){await this.sendError(n,e,t),this.client.logger.error(t)}},this.onSessionProposeResponse=async(e,t)=>{const{id:r}=t;if((0,it.isJsonRpcResult)(t)){const{result:n}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:n});const i=this.client.proposal.get(r);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:i});const s=i.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:s});const o=n.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:o});const a=await this.client.core.crypto.generateSharedKey(s,o);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:a});const c=await this.client.core.relayer.subscribe(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:c}),await this.client.core.pairing.activate({topic:e})}else(0,it.isJsonRpcError)(t)&&(await this.client.proposal.delete(r,Ve("USER_DISCONNECTED")),this.events.emit(Re("session_connect"),{error:t.error}))},this.onSessionSettleRequest=async(e,t)=>{const{id:r,params:n}=t;try{this.isValidSessionSettleRequest(n);const{relay:r,controller:i,expiry:s,namespaces:o,requiredNamespaces:a,optionalNamespaces:c,sessionProperties:u,pairingTopic:h}=t.params,l=gi({topic:e,relay:r,expiry:s,namespaces:o,acknowledged:!0,pairingTopic:h,requiredNamespaces:a,optionalNamespaces:c,controller:i.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:i.publicKey,metadata:i.metadata}},u&&{sessionProperties:u});await this.sendResult(t.id,e,!0),this.events.emit(Re("session_connect"),{session:l}),this.cleanupDuplicatePairings(l)}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionSettleResponse=async(e,t)=>{const{id:r}=t;(0,it.isJsonRpcResult)(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(Re("session_approve",r),{})):(0,it.isJsonRpcError)(t)&&(await this.client.session.delete(e,Ve("USER_DISCONNECTED")),this.events.emit(Re("session_approve",r),{error:t.error}))},this.onSessionUpdateRequest=async(e,t)=>{const{params:r,id:n}=t;try{this.isValidUpdate(gi({topic:e},r)),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult(n,e,!0),this.client.events.emit("session_update",{id:n,topic:e,params:r})}catch(t){await this.sendError(n,e,t),this.client.logger.error(t)}},this.onSessionUpdateResponse=(e,t)=>{const{id:r}=t;(0,it.isJsonRpcResult)(t)?this.events.emit(Re("session_update",r),{}):(0,it.isJsonRpcError)(t)&&this.events.emit(Re("session_update",r),{error:t.error})},this.onSessionExtendRequest=async(e,t)=>{const{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,Oe(ri)),await this.sendResult(r,e,!0),this.client.events.emit("session_extend",{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionExtendResponse=(e,t)=>{const{id:r}=t;(0,it.isJsonRpcResult)(t)?this.events.emit(Re("session_extend",r),{}):(0,it.isJsonRpcError)(t)&&this.events.emit(Re("session_extend",r),{error:t.error})},this.onSessionPingRequest=async(e,t)=>{const{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult(r,e,!0),this.client.events.emit("session_ping",{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionPingResponse=(e,t)=>{const{id:r}=t;setTimeout((()=>{(0,it.isJsonRpcResult)(t)?this.events.emit(Re("session_ping",r),{}):(0,it.isJsonRpcError)(t)&&this.events.emit(Re("session_ping",r),{error:t.error})}),500)},this.onSessionDeleteRequest=async(e,t)=>{const{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),await Promise.all([new Promise((t=>{this.client.core.relayer.once(Gr,(async()=>{t(await this.deleteSession(e))}))})),this.sendResult(r,e,!0)]),this.client.events.emit("session_delete",{id:r,topic:e})}catch(e){this.client.logger.error(e)}},this.onSessionRequest=async(e,t)=>{const{id:r,params:n}=t;try{this.isValidRequest(gi({topic:e},n)),await this.setPendingSessionRequest({id:r,topic:e,params:n}),this.addRequestToQueue({id:r,topic:e,params:n}),await this.processRequestQueue()}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionRequestResponse=(e,t)=>{const{id:r}=t;(0,it.isJsonRpcResult)(t)?this.events.emit(Re("session_request",r),{result:t.result}):(0,it.isJsonRpcError)(t)&&this.events.emit(Re("session_request",r),{error:t.error})},this.onSessionEventRequest=async(e,t)=>{const{id:r,params:n}=t;try{this.isValidEmit(gi({topic:e},n)),this.client.events.emit("session_event",{id:r,topic:e,params:n})}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.addRequestToQueue=e=>{this.requestQueue.requests.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout((()=>{this.requestQueue.state=si,this.processRequestQueue()}),(0,l.toMiliseconds)(this.requestQueueDelay))},this.processRequestQueue=async()=>{if(this.requestQueue.state===oi)return void this.client.logger.info("session request queue is already active.");const e=this.requestQueue.requests[0];if(e)try{const{id:t,topic:r,params:n}=e,i=ee(JSON.stringify({id:t,params:n})),s=this.client.session.get(r),o=await this.getVerifyContext(i,s.peer.metadata);this.requestQueue.state=oi,this.client.events.emit("session_request",{id:t,topic:r,params:n,verifyContext:o})}catch(e){this.client.logger.error(e)}else this.client.logger.info("session request queue is empty.")},this.isValidConnect=async e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(t)}const{pairingTopic:t,requiredNamespaces:r,optionalNamespaces:n,sessionProperties:i,relays:s}=e;if(Fe(t)||await this.isValidPairingTopic(t),!function(e,t){let r=!1;return e?e&&Ke(e)&&e.length&&e.forEach((e=>{r=Ze(e)})):r=!0,r}(s)){const{message:e}=ze("MISSING_OR_INVALID",`connect() relays: ${s}`);throw new Error(e)}!Fe(r)&&0!==We(r)&&this.validateNamespaces(r,"requiredNamespaces"),!Fe(n)&&0!==We(n)&&this.validateNamespaces(n,"optionalNamespaces"),Fe(i)||this.validateSessionProps(i,"sessionProperties")},this.validateNamespaces=(e,t)=>{const r=function(e,t,r){let n=null;if(e&&We(e)){const i=Qe(e,t);i&&(n=i);const s=function(e,t,r){let n=null;return Object.entries(e).forEach((([e,i])=>{if(n)return;const s=function(e,t,r){let n=null;return Ke(t)&&t.length?t.forEach((e=>{n||Je(e)||(n=Ve("UNSUPPORTED_CHAINS",`${r}, chain ${e} should be a string and conform to "namespace:chainId" format`))})):Je(e)||(n=Ve("UNSUPPORTED_CHAINS",`${r}, 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"] }`)),n}(e,J(e,i),`${t} ${r}`);s&&(n=s)})),n}(e,t,r);s&&(n=s)}else n=ze("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return n}(e,"connect()",t);if(r)throw new Error(r.message)},this.isValidApprove=async e=>{if(!Xe(e))throw new Error(ze("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:t,namespaces:r,relayProtocol:n,sessionProperties:i}=e;await this.isValidProposalId(t);const s=this.client.proposal.get(t),o=Ye(r,"approve()");if(o)throw new Error(o.message);const a=tt(s.requiredNamespaces,r,"approve()");if(a)throw new Error(a.message);if(!He(n,!0)){const{message:e}=ze("MISSING_OR_INVALID",`approve() relayProtocol: ${n}`);throw new Error(e)}Fe(i)||this.validateSessionProps(i,"sessionProperties")},this.isValidReject=async e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(t)}const{id:t,reason:r}=e;if(await this.isValidProposalId(t),!function(e){return!!(e&&"object"==typeof e&&e.code&&Be(e.code,!1)&&e.message&&He(e.message,!1))}(r)){const{message:e}=ze("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidSessionSettleRequest=e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(t)}const{relay:t,controller:r,namespaces:n,expiry:i}=e;if(!Ze(t)){const{message:e}=ze("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(e)}const s=function(e,t){let r=null;return He(e?.publicKey,!1)||(r=ze("MISSING_OR_INVALID","onSessionSettleRequest() controller public key should be a string")),r}(r);if(s)throw new Error(s.message);const o=Ye(n,"onSessionSettleRequest()");if(o)throw new Error(o.message);if(Ne(i)){const{message:e}=ze("EXPIRED","onSessionSettleRequest()");throw new Error(e)}},this.isValidUpdate=async e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(t)}const{topic:t,namespaces:r}=e;await this.isValidSessionTopic(t);const n=this.client.session.get(t),i=Ye(r,"update()");if(i)throw new Error(i.message);const s=tt(n.requiredNamespaces,r,"update()");if(s)throw new Error(s.message)},this.isValidExtend=async e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(t)}const{topic:t,request:r,chainId:n,expiry:i}=e;await this.isValidSessionTopic(t);const{namespaces:s}=this.client.session.get(t);if(!et(s,n)){const{message:e}=ze("MISSING_OR_INVALID",`request() chainId: ${n}`);throw new Error(e)}if(!function(e){return!(Fe(e)||!He(e.method,!1))}(r)){const{message:e}=ze("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw new Error(e)}if(!function(e,t,r){return!!He(r,!1)&&function(e,t){const r=[];return Object.values(e).forEach((e=>{qe(e.accounts).includes(t)&&r.push(...e.methods)})),r}(e,t).includes(r)}(s,n,r.method)){const{message:e}=ze("MISSING_OR_INVALID",`request() method: ${r.method}`);throw new Error(e)}if(i&&!function(e,t){return Be(e,!1)&&e<=t.max&&e>=t.min}(i,ii)){const{message:e}=ze("MISSING_OR_INVALID",`request() expiry: ${i}. Expiry must be a number (in seconds) between ${ii.min} and ${ii.max}`);throw new Error(e)}},this.isValidRespond=async e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(t)}const{topic:t,response:r}=e;if(await this.isValidSessionTopic(t),!function(e){return!(Fe(e)||Fe(e.result)&&Fe(e.error)||!Be(e.id,!1)||!He(e.jsonrpc,!1))}(r)){const{message:e}=ze("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidPing=async e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(t)}const{topic:t,event:r,chainId:n}=e;await this.isValidSessionTopic(t);const{namespaces:i}=this.client.session.get(t);if(!et(i,n)){const{message:e}=ze("MISSING_OR_INVALID",`emit() chainId: ${n}`);throw new Error(e)}if(!function(e){return!(Fe(e)||!He(e.name,!1))}(r)){const{message:e}=ze("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(e)}if(!function(e,t,r){return!!He(r,!1)&&function(e,t){const r=[];return Object.values(e).forEach((e=>{qe(e.accounts).includes(t)&&r.push(...e.events)})),r}(e,t).includes(r)}(i,n,r.name)){const{message:e}=ze("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidDisconnect=async e=>{if(!Xe(e)){const{message:t}=ze("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.getVerifyContext=async(e,t)=>{const r={verified:{verifyUrl:t.verifyUrl||"",validation:"UNKNOWN",origin:t.url||""}};try{const n=await this.client.core.verify.resolve({attestationId:e,verifyUrl:t.verifyUrl});n&&(r.verified.origin=n,r.verified.validation=n===t.url?"VALID":"INVALID")}catch(e){this.client.logger.error(e)}return this.client.logger.info(`Verify context: ${JSON.stringify(r)}`),r},this.validateSessionProps=(e,t)=>{Object.values(e).forEach((e=>{if(!He(e,!1)){const{message:r}=ze("MISSING_OR_INVALID",`${t} must be in Record format. Received: ${JSON.stringify(e)}`);throw new Error(r)}}))}}isInitialized(){if(!this.initialized){const{message:e}=ze("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(Kr,(async e=>{const{topic:t,message:r}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(r)))return;const n=await this.client.core.crypto.decode(t,r);(0,it.isJsonRpcRequest)(n)?(this.client.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):(0,it.isJsonRpcResponse)(n)?(await this.client.core.history.resolve(n),await this.onRelayEventResponse({topic:t,payload:n}),this.client.core.history.delete(t,n.id)):this.onRelayEventUnknownPayload({topic:t,payload:n})}))}registerExpirerEvents(){this.client.core.expirer.on(un,(async e=>{const{topic:t,id:r}=Pe(e.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,ze("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))}))}isValidPairingTopic(e){if(!He(e,!1)){const{message:t}=ze("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=ze("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Ne(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=ze("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!He(e,!1)){const{message:t}=ze("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){const{message:t}=ze("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Ne(this.client.session.get(e).expiry)){await this.deleteSession(e);const{message:t}=ze("EXPIRED",`session topic: ${e}`);throw new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else{if(!this.client.core.pairing.pairings.keys.includes(e)){if(He(e,!1)){const{message:t}=ze("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}{const{message:t}=ze("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}this.isValidPairingTopic(e)}}async isValidProposalId(e){if("number"!=typeof e){const{message:t}=ze("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=ze("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Ne(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);const{message:t}=ze("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class vi extends Ln{constructor(e,t){super(e,t,"proposal",Xn),this.core=e,this.logger=t}}class wi extends Ln{constructor(e,t){super(e,t,"session",Xn),this.core=e,this.logger=t}}class bi extends Ln{constructor(e,t){super(e,t,"request",Xn,(e=>e.id)),this.core=e,this.logger=t}}class _i extends R{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=ei,this.events=new n.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}},this.update=async e=>{try{return await this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}},this.request=async e=>{try{return await this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}},this.find=e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.name=e?.name||ei,this.metadata=e?.metadata||(0,F.D)()||{name:"",description:"",url:"",icons:[""]};const t=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:(0,m.pino)((0,m.getDefaultLoggerOptions)({level:e?.logger||"error"}));this.core=e?.core||new Yn(e),this.logger=(0,m.generateChildLogger)(t,this.name),this.session=new wi(this.core,this.logger),this.proposal=new vi(this.core,this.logger),this.pendingRequest=new bi(this.core,this.logger),this.engine=new mi(this)}static async init(e){const t=new _i(e);return await t.initialize(),t}get context(){return(0,m.getLoggerContext)(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}function Ei(e=[],t=[]){return[...new Set([...e,...t])]}function Ii(e){return e.includes(":")}function Si(e){return Ii(e)?e.split(":")[0]:e}r(3382),r(99982),r(94543),r(34155),Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable,Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable,Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;const Pi={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function Oi(e,t){const{message:r,code:n}=Pi[e];return{message:t?`${r} ${t}`:r,code:n}}function Ni(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}var Ri=r(84497);const Ci="error",xi="wc@2:universal_provider:",Ti="default_chain_changed";var Ai=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof r.g<"u"?r.g:typeof self<"u"?self:{},ji={exports:{}};!function(e,t){(function(){var r,n="Expected a function",i="__lodash_hash_undefined__",s="__lodash_placeholder__",o=32,a=128,c=1/0,u=9007199254740991,h=NaN,l=4294967295,p=[["ary",a],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",o],["partialRight",64],["rearg",256]],d="[object Arguments]",f="[object Array]",g="[object Boolean]",y="[object Date]",m="[object Error]",v="[object Function]",w="[object GeneratorFunction]",b="[object Map]",_="[object Number]",E="[object Object]",I="[object Promise]",S="[object RegExp]",P="[object Set]",O="[object String]",N="[object Symbol]",R="[object WeakMap]",C="[object ArrayBuffer]",x="[object DataView]",T="[object Float32Array]",A="[object Float64Array]",j="[object Int8Array]",D="[object Int16Array]",U="[object Int32Array]",k="[object Uint8Array]",$="[object Uint8ClampedArray]",q="[object Uint16Array]",L="[object Uint32Array]",M=/\b__p \+= '';/g,z=/\b(__p \+=) '' \+/g,V=/(__e\(.*?\)|\b__t\)) \+\n'';/g,K=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,F=RegExp(K.source),H=RegExp(W.source),B=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,G=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y=/^\w*$/,Z=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,X=/[\\^$.*+?()[\]{}|]/g,ee=RegExp(X.source),te=/^\s+/,re=/\s/,ne=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ie=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,oe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ae=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,ue=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,he=/\w*$/,le=/^[-+]0x[0-9a-f]+$/i,pe=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,fe=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,me=/($^)/,ve=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",be="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_e="\\u2700-\\u27bf",Ee="a-z\\xdf-\\xf6\\xf8-\\xff",Ie="A-Z\\xc0-\\xd6\\xd8-\\xde",Se="\\ufe0e\\ufe0f",Pe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Oe="["+we+"]",Ne="["+Pe+"]",Re="["+be+"]",Ce="\\d+",xe="["+_e+"]",Te="["+Ee+"]",Ae="[^"+we+Pe+Ce+_e+Ee+Ie+"]",je="\\ud83c[\\udffb-\\udfff]",De="[^"+we+"]",Ue="(?:\\ud83c[\\udde6-\\uddff]){2}",ke="[\\ud800-\\udbff][\\udc00-\\udfff]",$e="["+Ie+"]",qe="\\u200d",Le="(?:"+Te+"|"+Ae+")",Me="(?:"+$e+"|"+Ae+")",ze="(?:['’](?:d|ll|m|re|s|t|ve))?",Ve="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ke="(?:"+Re+"|"+je+")?",We="["+Se+"]?",Fe=We+Ke+"(?:"+qe+"(?:"+[De,Ue,ke].join("|")+")"+We+Ke+")*",He="(?:"+[xe,Ue,ke].join("|")+")"+Fe,Be="(?:"+[De+Re+"?",Re,Ue,ke,Oe].join("|")+")",Je=RegExp("['’]","g"),Ge=RegExp(Re,"g"),Qe=RegExp(je+"(?="+je+")|"+Be+Fe,"g"),Ye=RegExp([$e+"?"+Te+"+"+ze+"(?="+[Ne,$e,"$"].join("|")+")",Me+"+"+Ve+"(?="+[Ne,$e+Le,"$"].join("|")+")",$e+"?"+Le+"+"+ze,$e+"+"+Ve,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ce,He].join("|"),"g"),Ze=RegExp("["+qe+we+be+Se+"]"),Xe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,et=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],tt=-1,rt={};rt[T]=rt[A]=rt[j]=rt[D]=rt[U]=rt[k]=rt[$]=rt[q]=rt[L]=!0,rt[d]=rt[f]=rt[C]=rt[g]=rt[x]=rt[y]=rt[m]=rt[v]=rt[b]=rt[_]=rt[E]=rt[S]=rt[P]=rt[O]=rt[R]=!1;var nt={};nt[d]=nt[f]=nt[C]=nt[x]=nt[g]=nt[y]=nt[T]=nt[A]=nt[j]=nt[D]=nt[U]=nt[b]=nt[_]=nt[E]=nt[S]=nt[P]=nt[O]=nt[N]=nt[k]=nt[$]=nt[q]=nt[L]=!0,nt[m]=nt[v]=nt[R]=!1;var it={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,ot=parseInt,at="object"==typeof Ai&&Ai&&Ai.Object===Object&&Ai,ct="object"==typeof self&&self&&self.Object===Object&&self,ut=at||ct||Function("return this")(),ht=t&&!t.nodeType&&t,lt=ht&&e&&!e.nodeType&&e,pt=lt&<.exports===ht,dt=pt&&at.process,ft=function(){try{return lt&<.require&<.require("util").types||dt&&dt.binding&&dt.binding("util")}catch{}}(),gt=ft&&ft.isArrayBuffer,yt=ft&&ft.isDate,mt=ft&&ft.isMap,vt=ft&&ft.isRegExp,wt=ft&&ft.isSet,bt=ft&&ft.isTypedArray;function _t(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function Et(e,t,r,n){for(var i=-1,s=null==e?0:e.length;++i-1}function Rt(e,t,r){for(var n=-1,i=null==e?0:e.length;++n-1;);return r}function Yt(e,t){for(var r=e.length;r--&&$t(t,e[r],0)>-1;);return r}var Zt=Vt({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Xt=Vt({"&":"&","<":"<",">":">",'"':""","'":"'"});function er(e){return"\\"+it[e]}function tr(e){return Ze.test(e)}function rr(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function nr(e,t){return function(r){return e(t(r))}}function ir(e,t){for(var r=-1,n=e.length,i=0,o=[];++r",""":'"',"'":"'"}),hr=function e(t){var re=(t=null==t?ut:hr.defaults(ut.Object(),t,hr.pick(ut,et))).Array,we=t.Date,be=t.Error,_e=t.Function,Ee=t.Math,Ie=t.Object,Se=t.RegExp,Pe=t.String,Oe=t.TypeError,Ne=re.prototype,Re=_e.prototype,Ce=Ie.prototype,xe=t["__core-js_shared__"],Te=Re.toString,Ae=Ce.hasOwnProperty,je=0,De=function(){var e=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ue=Ce.toString,ke=Te.call(Ie),$e=ut._,qe=Se("^"+Te.call(Ae).replace(X,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=pt?t.Buffer:r,Me=t.Symbol,ze=t.Uint8Array,Ve=Le?Le.allocUnsafe:r,Ke=nr(Ie.getPrototypeOf,Ie),We=Ie.create,Fe=Ce.propertyIsEnumerable,He=Ne.splice,Be=Me?Me.isConcatSpreadable:r,Qe=Me?Me.iterator:r,Ze=Me?Me.toStringTag:r,it=function(){try{var e=os(Ie,"defineProperty");return e({},"",{}),e}catch{}}(),at=t.clearTimeout!==ut.clearTimeout&&t.clearTimeout,ct=we&&we.now!==ut.Date.now&&we.now,ht=t.setTimeout!==ut.setTimeout&&t.setTimeout,lt=Ee.ceil,dt=Ee.floor,ft=Ie.getOwnPropertySymbols,Dt=Le?Le.isBuffer:r,Vt=t.isFinite,lr=Ne.join,pr=nr(Ie.keys,Ie),dr=Ee.max,fr=Ee.min,gr=we.now,yr=t.parseInt,mr=Ee.random,vr=Ne.reverse,wr=os(t,"DataView"),br=os(t,"Map"),_r=os(t,"Promise"),Er=os(t,"Set"),Ir=os(t,"WeakMap"),Sr=os(Ie,"create"),Pr=Ir&&new Ir,Or={},Nr=Ds(wr),Rr=Ds(br),Cr=Ds(_r),xr=Ds(Er),Tr=Ds(Ir),Ar=Me?Me.prototype:r,jr=Ar?Ar.valueOf:r,Dr=Ar?Ar.toString:r;function Ur(e){if(Zo(e)&&!zo(e)&&!(e instanceof Lr)){if(e instanceof qr)return e;if(Ae.call(e,"__wrapped__"))return Us(e)}return new qr(e)}var kr=function(){function e(){}return function(t){if(!Yo(t))return{};if(We)return We(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function $r(){}function qr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function Lr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=l,this.__views__=[]}function Mr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function nn(e,t,n,i,s,o){var a,c=1&t,u=2&t,h=4&t;if(n&&(a=s?n(e,i,s,o):n(e)),a!==r)return a;if(!Yo(e))return e;var l=zo(e);if(l){if(a=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Ae.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!c)return Si(e,a)}else{var p=us(e),f=p==v||p==w;if(Fo(e))return vi(e,c);if(p==E||p==d||f&&!s){if(a=u||f?{}:ls(e),!c)return u?function(e,t){return Pi(e,cs(e),t)}(e,function(e,t){return e&&Pi(t,Ca(t),e)}(a,e)):function(e,t){return Pi(e,as(e),t)}(e,Xr(a,e))}else{if(!nt[p])return s?e:{};a=function(e,t,r){var n=e.constructor;switch(t){case C:return wi(e);case g:case y:return new n(+e);case x:return function(e,t){var r=t?wi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case T:case A:case j:case D:case U:case k:case $:case q:case L:return bi(e,r);case b:return new n;case _:case O:return new n(e);case S:return function(e){var t=new e.constructor(e.source,he.exec(e));return t.lastIndex=e.lastIndex,t}(e);case P:return new n;case N:return function(e){return jr?Ie(jr.call(e)):{}}(e)}}(e,p,c)}}o||(o=new Wr);var m=o.get(e);if(m)return m;o.set(e,a),na(e)?e.forEach((function(r){a.add(nn(r,t,n,r,e,o))})):Xo(e)&&e.forEach((function(r,i){a.set(i,nn(r,t,n,i,e,o))}));var I=l?r:(h?u?Xi:Zi:u?Ca:Ra)(e);return It(I||e,(function(r,i){I&&(r=e[i=r]),Qr(a,i,nn(r,t,n,i,e,o))})),a}function sn(e,t,n){var i=n.length;if(null==e)return!i;for(e=Ie(e);i--;){var s=n[i],o=t[s],a=e[s];if(a===r&&!(s in e)||!o(a))return!1}return!0}function on(e,t,i){if("function"!=typeof e)throw new Oe(n);return Ps((function(){e.apply(r,i)}),t)}function an(e,t,r,n){var i=-1,s=Nt,o=!0,a=e.length,c=[],u=t.length;if(!a)return c;r&&(t=Ct(t,Bt(r))),n?(s=Rt,o=!1):t.length>=200&&(s=Gt,o=!1,t=new Kr(t));e:for(;++i-1},zr.prototype.set=function(e,t){var r=this.__data__,n=Yr(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Vr.prototype.clear=function(){this.size=0,this.__data__={hash:new Mr,map:new(br||zr),string:new Mr}},Vr.prototype.delete=function(e){var t=is(this,e).delete(e);return this.size-=t?1:0,t},Vr.prototype.get=function(e){return is(this,e).get(e)},Vr.prototype.has=function(e){return is(this,e).has(e)},Vr.prototype.set=function(e,t){var r=is(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Kr.prototype.add=Kr.prototype.push=function(e){return this.__data__.set(e,i),this},Kr.prototype.has=function(e){return this.__data__.has(e)},Wr.prototype.clear=function(){this.__data__=new zr,this.size=0},Wr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Wr.prototype.get=function(e){return this.__data__.get(e)},Wr.prototype.has=function(e){return this.__data__.has(e)},Wr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof zr){var n=r.__data__;if(!br||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Vr(n)}return r.set(e,t),this.size=r.size,this};var cn=Ri(yn),un=Ri(mn,!0);function hn(e,t){var r=!0;return cn(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function ln(e,t,n){for(var i=-1,s=e.length;++i0&&r(a)?t>1?dn(a,t-1,r,n,i):xt(i,a):n||(i[i.length]=a)}return i}var fn=Ci(),gn=Ci(!0);function yn(e,t){return e&&fn(e,t,Ra)}function mn(e,t){return e&&gn(e,t,Ra)}function vn(e,t){return Ot(t,(function(t){return Jo(e[t])}))}function wn(e,t){for(var n=0,i=(t=fi(t,e)).length;null!=e&&nt}function In(e,t){return null!=e&&Ae.call(e,t)}function Sn(e,t){return null!=e&&t in Ie(e)}function Pn(e,t,n){for(var i=n?Rt:Nt,s=e[0].length,o=e.length,a=o,c=re(o),u=1/0,h=[];a--;){var l=e[a];a&&t&&(l=Ct(l,Bt(t))),u=fr(l.length,u),c[a]=!n&&(t||s>=120&&l.length>=120)?new Kr(a&&l):r}l=e[0];var p=-1,d=c[0];e:for(;++p=a?c:c*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}));n--;)e[n]=e[n].value;return e}(Dn(e,(function(e,r,i){return{criteria:Ct(t,(function(t){return t(e)})),index:++n,value:e}})))}function Mn(e,t,r){for(var n=-1,i=t.length,s={};++n-1;)a!==e&&He.call(a,c,1),He.call(e,c,1);return e}function Vn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==s){var s=i;ds(i)?He.call(e,i,1):oi(e,i)}}return e}function Kn(e,t){return e+dt(mr()*(t-e+1))}function Wn(e,t){var r="";if(!e||t<1||t>u)return r;do{t%2&&(r+=e),(t=dt(t/2))&&(e+=e)}while(t);return r}function Fn(e,t){return Os(_s(e,t,ec),e+"")}function Hn(e){return Hr($a(e))}function Bn(e,t){var r=$a(e);return Cs(r,rn(t,0,r.length))}function Jn(e,t,n,i){if(!Yo(e))return e;for(var s=-1,o=(t=fi(t,e)).length,a=o-1,c=e;null!=c&&++si?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var s=re(i);++n>>1,o=e[s];null!==o&&!sa(o)&&(r?o<=t:o=200){var u=t?null:Wi(e);if(u)return sr(u);o=!1,i=Gt,c=new Kr}else c=t?[]:a;e:for(;++n=i?e:Zn(e,t,n)}var mi=at||function(e){return ut.clearTimeout(e)};function vi(e,t){if(t)return e.slice();var r=e.length,n=Ve?Ve(r):new e.constructor(r);return e.copy(n),n}function wi(e){var t=new e.constructor(e.byteLength);return new ze(t).set(new ze(e)),t}function bi(e,t){var r=t?wi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function _i(e,t){if(e!==t){var n=e!==r,i=null===e,s=e==e,o=sa(e),a=t!==r,c=null===t,u=t==t,h=sa(t);if(!c&&!h&&!o&&e>t||o&&a&&u&&!c&&!h||i&&a&&u||!n&&u||!s)return 1;if(!i&&!o&&!h&&e1?n[s-1]:r,a=s>2?n[2]:r;for(o=e.length>3&&"function"==typeof o?(s--,o):r,a&&fs(n[0],n[1],a)&&(o=s<3?r:o,s=1),t=Ie(t);++i-1?s[o?t[a]:a]:r}}function Di(e){return Yi((function(t){var i=t.length,s=i,o=qr.prototype.thru;for(e&&t.reverse();s--;){var a=t[s];if("function"!=typeof a)throw new Oe(n);if(o&&!c&&"wrapper"==ts(a))var c=new qr([],!0)}for(s=c?s:i;++s1&&w.reverse(),p&&hc))return!1;var h=o.get(e),l=o.get(t);if(h&&l)return h==t&&l==e;var p=-1,d=!0,f=2&n?new Kr:r;for(o.set(e,t),o.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(ne,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return It(p,(function(r){var n="_."+r[0];t&r[1]&&!Nt(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(ie);return t?t[1].split(se):[]}(n),r)))}function Rs(e){var t=0,n=0;return function(){var i=gr(),s=16-(i-n);if(n=i,s>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Cs(e,t){var n=-1,i=e.length,s=i-1;for(t=t===r?i:t;++n1?e[t-1]:r;return n="function"==typeof n?(e.pop(),n):r,to(e,n)}));function co(e){var t=Ur(e);return t.__chain__=!0,t}function uo(e,t){return t(e)}var ho=Yi((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,s=function(t){return tn(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Lr&&ds(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:uo,args:[s],thisArg:r}),new qr(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(r),e}))):this.thru(s)})),lo=Oi((function(e,t,r){Ae.call(e,r)?++e[r]:en(e,r,1)})),po=ji(Ls),fo=ji(Ms);function go(e,t){return(zo(e)?It:cn)(e,ns(t,3))}function yo(e,t){return(zo(e)?St:un)(e,ns(t,3))}var mo=Oi((function(e,t,r){Ae.call(e,r)?e[r].push(t):en(e,r,[t])})),vo=Fn((function(e,t,r){var n=-1,i="function"==typeof t,s=Ko(e)?re(e.length):[];return cn(e,(function(e){s[++n]=i?_t(t,e,r):On(e,t,r)})),s})),wo=Oi((function(e,t,r){en(e,r,t)}));function bo(e,t){return(zo(e)?Ct:Dn)(e,ns(t,3))}var _o=Oi((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]})),Eo=Fn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&fs(e,t[0],t[1])?t=[]:r>2&&fs(t[0],t[1],t[2])&&(t=[t[0]]),Ln(e,dn(t,1),[])})),Io=ct||function(){return ut.Date.now()};function So(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Hi(e,a,r,r,r,r,t)}function Po(e,t){var i;if("function"!=typeof t)throw new Oe(n);return e=la(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=r),i}}var Oo=Fn((function(e,t,r){var n=1;if(r.length){var i=ir(r,rs(Oo));n|=o}return Hi(e,n,t,r,i)})),No=Fn((function(e,t,r){var n=3;if(r.length){var i=ir(r,rs(No));n|=o}return Hi(t,n,e,r,i)}));function Ro(e,t,i){var s,o,a,c,u,h,l=0,p=!1,d=!1,f=!0;if("function"!=typeof e)throw new Oe(n);function g(t){var n=s,i=o;return s=o=r,l=t,c=e.apply(i,n)}function y(e){var n=e-h;return h===r||n>=t||n<0||d&&e-l>=a}function m(){var e=Io();if(y(e))return v(e);u=Ps(m,function(e){var r=t-(e-h);return d?fr(r,a-(e-l)):r}(e))}function v(e){return u=r,f&&s?g(e):(s=o=r,c)}function w(){var e=Io(),n=y(e);if(s=arguments,o=this,h=e,n){if(u===r)return function(e){return l=e,u=Ps(m,t),p?g(e):c}(h);if(d)return mi(u),u=Ps(m,t),g(h)}return u===r&&(u=Ps(m,t)),c}return t=da(t)||0,Yo(i)&&(p=!!i.leading,a=(d="maxWait"in i)?dr(da(i.maxWait)||0,t):a,f="trailing"in i?!!i.trailing:f),w.cancel=function(){u!==r&&mi(u),l=0,s=h=o=u=r},w.flush=function(){return u===r?c:v(Io())},w}var Co=Fn((function(e,t){return on(e,1,t)})),xo=Fn((function(e,t,r){return on(e,da(t)||0,r)}));function To(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Oe(n);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(To.Cache||Vr),r}function Ao(e){if("function"!=typeof e)throw new Oe(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}To.Cache=Vr;var jo=gi((function(e,t){var r=(t=1==t.length&&zo(t[0])?Ct(t[0],Bt(ns())):Ct(dn(t,1),Bt(ns()))).length;return Fn((function(n){for(var i=-1,s=fr(n.length,r);++i=t})),Mo=Nn(function(){return arguments}())?Nn:function(e){return Zo(e)&&Ae.call(e,"callee")&&!Fe.call(e,"callee")},zo=re.isArray,Vo=gt?Bt(gt):function(e){return Zo(e)&&_n(e)==C};function Ko(e){return null!=e&&Qo(e.length)&&!Jo(e)}function Wo(e){return Zo(e)&&Ko(e)}var Fo=Dt||dc,Ho=yt?Bt(yt):function(e){return Zo(e)&&_n(e)==y};function Bo(e){if(!Zo(e))return!1;var t=_n(e);return t==m||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ta(e)}function Jo(e){if(!Yo(e))return!1;var t=_n(e);return t==v||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Go(e){return"number"==typeof e&&e==la(e)}function Qo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function Yo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Zo(e){return null!=e&&"object"==typeof e}var Xo=mt?Bt(mt):function(e){return Zo(e)&&us(e)==b};function ea(e){return"number"==typeof e||Zo(e)&&_n(e)==_}function ta(e){if(!Zo(e)||_n(e)!=E)return!1;var t=Ke(e);if(null===t)return!0;var r=Ae.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Te.call(r)==ke}var ra=vt?Bt(vt):function(e){return Zo(e)&&_n(e)==S},na=wt?Bt(wt):function(e){return Zo(e)&&us(e)==P};function ia(e){return"string"==typeof e||!zo(e)&&Zo(e)&&_n(e)==O}function sa(e){return"symbol"==typeof e||Zo(e)&&_n(e)==N}var oa=bt?Bt(bt):function(e){return Zo(e)&&Qo(e.length)&&!!rt[_n(e)]},aa=zi(jn),ca=zi((function(e,t){return e<=t}));function ua(e){if(!e)return[];if(Ko(e))return ia(e)?ar(e):Si(e);if(Qe&&e[Qe])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Qe]());var t=us(e);return(t==b?rr:t==P?sr:$a)(e)}function ha(e){return e?(e=da(e))===c||e===-c?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function la(e){var t=ha(e),r=t%1;return t==t?r?t-r:t:0}function pa(e){return e?rn(la(e),0,l):0}function da(e){if("number"==typeof e)return e;if(sa(e))return h;if(Yo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Yo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ht(e);var r=pe.test(e);return r||fe.test(e)?ot(e.slice(2),r?2:8):le.test(e)?h:+e}function fa(e){return Pi(e,Ca(e))}function ga(e){return null==e?"":ii(e)}var ya=Ni((function(e,t){if(vs(t)||Ko(t))Pi(t,Ra(t),e);else for(var r in t)Ae.call(t,r)&&Qr(e,r,t[r])})),ma=Ni((function(e,t){Pi(t,Ca(t),e)})),va=Ni((function(e,t,r,n){Pi(t,Ca(t),e,n)})),wa=Ni((function(e,t,r,n){Pi(t,Ra(t),e,n)})),ba=Yi(tn),_a=Fn((function(e,t){e=Ie(e);var n=-1,i=t.length,s=i>2?t[2]:r;for(s&&fs(t[0],t[1],s)&&(i=1);++n1),t})),Pi(e,Xi(e),r),n&&(r=nn(r,7,Gi));for(var i=t.length;i--;)oi(r,t[i]);return r})),ja=Yi((function(e,t){return null==e?{}:function(e,t){return Mn(e,t,(function(t,r){return Sa(e,r)}))}(e,t)}));function Da(e,t){if(null==e)return{};var r=Ct(Xi(e),(function(e){return[e]}));return t=ns(t),Mn(e,r,(function(e,r){return t(e,r[0])}))}var Ua=Fi(Ra),ka=Fi(Ca);function $a(e){return null==e?[]:Jt(e,Ra(e))}var qa=Ti((function(e,t,r){return t=t.toLowerCase(),e+(r?La(t):t)}));function La(e){return Ba(ga(e).toLowerCase())}function Ma(e){return(e=ga(e))&&e.replace(ye,Zt).replace(Ge,"")}var za=Ti((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Va=Ti((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),Ka=xi("toLowerCase"),Wa=Ti((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()})),Fa=Ti((function(e,t,r){return e+(r?" ":"")+Ba(t)})),Ha=Ti((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Ba=xi("toUpperCase");function Ja(e,t,n){return e=ga(e),(t=n?r:t)===r?function(e){return Xe.test(e)}(e)?function(e){return e.match(Ye)||[]}(e):function(e){return e.match(oe)||[]}(e):e.match(t)||[]}var Ga=Fn((function(e,t){try{return _t(e,r,t)}catch(e){return Bo(e)?e:new be(e)}})),Qa=Yi((function(e,t){return It(t,(function(t){t=js(t),en(e,t,Oo(e[t],e))})),e}));function Ya(e){return function(){return e}}var Za=Di(),Xa=Di(!0);function ec(e){return e}function tc(e){return Tn("function"==typeof e?e:nn(e,1))}var rc=Fn((function(e,t){return function(r){return On(r,e,t)}})),nc=Fn((function(e,t){return function(r){return On(e,r,t)}}));function ic(e,t,r){var n=Ra(t),i=vn(t,n);null==r&&(!Yo(t)||!i.length&&n.length)&&(r=t,t=e,e=this,i=vn(t,Ra(t)));var s=!(Yo(r)&&"chain"in r&&!r.chain),o=Jo(e);return It(i,(function(r){var n=t[r];e[r]=n,o&&(e.prototype[r]=function(){var t=this.__chain__;if(s||t){var r=e(this.__wrapped__);return(r.__actions__=Si(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,xt([this.value()],arguments))})})),e}function sc(){}var oc=qi(Ct),ac=qi(Pt),cc=qi(jt);function uc(e){return gs(e)?zt(js(e)):function(e){return function(t){return wn(t,e)}}(e)}var hc=Mi(),lc=Mi(!0);function pc(){return[]}function dc(){return!1}var fc=$i((function(e,t){return e+t}),0),gc=Ki("ceil"),yc=$i((function(e,t){return e/t}),1),mc=Ki("floor"),vc=$i((function(e,t){return e*t}),1),wc=Ki("round"),bc=$i((function(e,t){return e-t}),0);return Ur.after=function(e,t){if("function"!=typeof t)throw new Oe(n);return e=la(e),function(){if(--e<1)return t.apply(this,arguments)}},Ur.ary=So,Ur.assign=ya,Ur.assignIn=ma,Ur.assignInWith=va,Ur.assignWith=wa,Ur.at=ba,Ur.before=Po,Ur.bind=Oo,Ur.bindAll=Qa,Ur.bindKey=No,Ur.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return zo(e)?e:[e]},Ur.chain=co,Ur.chunk=function(e,t,n){t=(n?fs(e,t,n):t===r)?1:dr(la(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var s=0,o=0,a=re(lt(i/t));ss?0:s+n),(i=i===r||i>s?s:la(i))<0&&(i+=s),i=n>i?0:pa(i);n>>0)?(e=ga(e))&&("string"==typeof t||null!=t&&!ra(t))&&!(t=ii(t))&&tr(e)?yi(ar(e),0,n):e.split(t,n):[]},Ur.spread=function(e,t){if("function"!=typeof e)throw new Oe(n);return t=null==t?0:dr(la(t),0),Fn((function(r){var n=r[t],i=yi(r,0,t);return n&&xt(i,n),_t(e,this,i)}))},Ur.tail=function(e){var t=null==e?0:e.length;return t?Zn(e,1,t):[]},Ur.take=function(e,t,n){return e&&e.length?Zn(e,0,(t=n||t===r?1:la(t))<0?0:t):[]},Ur.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?Zn(e,(t=i-(t=n||t===r?1:la(t)))<0?0:t,i):[]},Ur.takeRightWhile=function(e,t){return e&&e.length?ci(e,ns(t,3),!1,!0):[]},Ur.takeWhile=function(e,t){return e&&e.length?ci(e,ns(t,3)):[]},Ur.tap=function(e,t){return t(e),e},Ur.throttle=function(e,t,r){var i=!0,s=!0;if("function"!=typeof e)throw new Oe(n);return Yo(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),Ro(e,t,{leading:i,maxWait:t,trailing:s})},Ur.thru=uo,Ur.toArray=ua,Ur.toPairs=Ua,Ur.toPairsIn=ka,Ur.toPath=function(e){return zo(e)?Ct(e,js):sa(e)?[e]:Si(As(ga(e)))},Ur.toPlainObject=fa,Ur.transform=function(e,t,r){var n=zo(e),i=n||Fo(e)||oa(e);if(t=ns(t,4),null==r){var s=e&&e.constructor;r=i?n?new s:[]:Yo(e)&&Jo(s)?kr(Ke(e)):{}}return(i?It:yn)(e,(function(e,n,i){return t(r,e,n,i)})),r},Ur.unary=function(e){return So(e,1)},Ur.union=Ys,Ur.unionBy=Zs,Ur.unionWith=Xs,Ur.uniq=function(e){return e&&e.length?si(e):[]},Ur.uniqBy=function(e,t){return e&&e.length?si(e,ns(t,2)):[]},Ur.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?si(e,r,t):[]},Ur.unset=function(e,t){return null==e||oi(e,t)},Ur.unzip=eo,Ur.unzipWith=to,Ur.update=function(e,t,r){return null==e?e:ai(e,t,di(r))},Ur.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:ai(e,t,di(n),i)},Ur.values=$a,Ur.valuesIn=function(e){return null==e?[]:Jt(e,Ca(e))},Ur.without=ro,Ur.words=Ja,Ur.wrap=function(e,t){return Do(di(t),e)},Ur.xor=no,Ur.xorBy=io,Ur.xorWith=so,Ur.zip=oo,Ur.zipObject=function(e,t){return li(e||[],t||[],Qr)},Ur.zipObjectDeep=function(e,t){return li(e||[],t||[],Jn)},Ur.zipWith=ao,Ur.entries=Ua,Ur.entriesIn=ka,Ur.extend=ma,Ur.extendWith=va,ic(Ur,Ur),Ur.add=fc,Ur.attempt=Ga,Ur.camelCase=qa,Ur.capitalize=La,Ur.ceil=gc,Ur.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=da(n))==n?n:0),t!==r&&(t=(t=da(t))==t?t:0),rn(da(e),t,n)},Ur.clone=function(e){return nn(e,4)},Ur.cloneDeep=function(e){return nn(e,5)},Ur.cloneDeepWith=function(e,t){return nn(e,5,t="function"==typeof t?t:r)},Ur.cloneWith=function(e,t){return nn(e,4,t="function"==typeof t?t:r)},Ur.conformsTo=function(e,t){return null==t||sn(e,t,Ra(t))},Ur.deburr=Ma,Ur.defaultTo=function(e,t){return null==e||e!=e?t:e},Ur.divide=yc,Ur.endsWith=function(e,t,n){e=ga(e),t=ii(t);var i=e.length,s=n=n===r?i:rn(la(n),0,i);return(n-=t.length)>=0&&e.slice(n,s)==t},Ur.eq=$o,Ur.escape=function(e){return(e=ga(e))&&H.test(e)?e.replace(W,Xt):e},Ur.escapeRegExp=function(e){return(e=ga(e))&&ee.test(e)?e.replace(X,"\\$&"):e},Ur.every=function(e,t,n){var i=zo(e)?Pt:hn;return n&&fs(e,t,n)&&(t=r),i(e,ns(t,3))},Ur.find=po,Ur.findIndex=Ls,Ur.findKey=function(e,t){return Ut(e,ns(t,3),yn)},Ur.findLast=fo,Ur.findLastIndex=Ms,Ur.findLastKey=function(e,t){return Ut(e,ns(t,3),mn)},Ur.floor=mc,Ur.forEach=go,Ur.forEachRight=yo,Ur.forIn=function(e,t){return null==e?e:fn(e,ns(t,3),Ca)},Ur.forInRight=function(e,t){return null==e?e:gn(e,ns(t,3),Ca)},Ur.forOwn=function(e,t){return e&&yn(e,ns(t,3))},Ur.forOwnRight=function(e,t){return e&&mn(e,ns(t,3))},Ur.get=Ia,Ur.gt=qo,Ur.gte=Lo,Ur.has=function(e,t){return null!=e&&hs(e,t,In)},Ur.hasIn=Sa,Ur.head=Vs,Ur.identity=ec,Ur.includes=function(e,t,r,n){e=Ko(e)?e:$a(e),r=r&&!n?la(r):0;var i=e.length;return r<0&&(r=dr(i+r,0)),ia(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&$t(e,t,r)>-1},Ur.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:la(r);return i<0&&(i=dr(n+i,0)),$t(e,t,i)},Ur.inRange=function(e,t,n){return t=ha(t),n===r?(n=t,t=0):n=ha(n),function(e,t,r){return e>=fr(t,r)&&e=-u&&e<=u},Ur.isSet=na,Ur.isString=ia,Ur.isSymbol=sa,Ur.isTypedArray=oa,Ur.isUndefined=function(e){return e===r},Ur.isWeakMap=function(e){return Zo(e)&&us(e)==R},Ur.isWeakSet=function(e){return Zo(e)&&"[object WeakSet]"==_n(e)},Ur.join=function(e,t){return null==e?"":lr.call(e,t)},Ur.kebabCase=za,Ur.last=Hs,Ur.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var s=i;return n!==r&&(s=(s=la(n))<0?dr(i+s,0):fr(s,i-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,s):kt(e,Lt,s,!0)},Ur.lowerCase=Va,Ur.lowerFirst=Ka,Ur.lt=aa,Ur.lte=ca,Ur.max=function(e){return e&&e.length?ln(e,ec,En):r},Ur.maxBy=function(e,t){return e&&e.length?ln(e,ns(t,2),En):r},Ur.mean=function(e){return Mt(e,ec)},Ur.meanBy=function(e,t){return Mt(e,ns(t,2))},Ur.min=function(e){return e&&e.length?ln(e,ec,jn):r},Ur.minBy=function(e,t){return e&&e.length?ln(e,ns(t,2),jn):r},Ur.stubArray=pc,Ur.stubFalse=dc,Ur.stubObject=function(){return{}},Ur.stubString=function(){return""},Ur.stubTrue=function(){return!0},Ur.multiply=vc,Ur.nth=function(e,t){return e&&e.length?qn(e,la(t)):r},Ur.noConflict=function(){return ut._===this&&(ut._=$e),this},Ur.noop=sc,Ur.now=Io,Ur.pad=function(e,t,r){e=ga(e);var n=(t=la(t))?or(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Li(dt(i),r)+e+Li(lt(i),r)},Ur.padEnd=function(e,t,r){e=ga(e);var n=(t=la(t))?or(e):0;return t&&nt){var i=e;e=t,t=i}if(n||e%1||t%1){var s=mr();return fr(e+s*(t-e+st("1e-"+((s+"").length-1))),t)}return Kn(e,t)},Ur.reduce=function(e,t,r){var n=zo(e)?Tt:Kt,i=arguments.length<3;return n(e,ns(t,4),r,i,cn)},Ur.reduceRight=function(e,t,r){var n=zo(e)?At:Kt,i=arguments.length<3;return n(e,ns(t,4),r,i,un)},Ur.repeat=function(e,t,n){return t=(n?fs(e,t,n):t===r)?1:la(t),Wn(ga(e),t)},Ur.replace=function(){var e=arguments,t=ga(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ur.result=function(e,t,n){var i=-1,s=(t=fi(t,e)).length;for(s||(s=1,e=r);++iu)return[];var r=l,n=fr(e,l);t=ns(t),e-=l;for(var i=Ft(n,t);++r=o)return e;var c=n-or(i);if(c<1)return i;var u=a?yi(a,0,c).join(""):e.slice(0,c);if(s===r)return u+i;if(a&&(c+=u.length-c),ra(s)){if(e.slice(c).search(s)){var h,l=u;for(s.global||(s=Se(s.source,ga(he.exec(s))+"g")),s.lastIndex=0;h=s.exec(l);)var p=h.index;u=u.slice(0,p===r?c:p)}}else if(e.indexOf(ii(s),c)!=c){var d=u.lastIndexOf(s);d>-1&&(u=u.slice(0,d))}return u+i},Ur.unescape=function(e){return(e=ga(e))&&F.test(e)?e.replace(K,ur):e},Ur.uniqueId=function(e){var t=++je;return ga(e)+t},Ur.upperCase=Ha,Ur.upperFirst=Ba,Ur.each=go,Ur.eachRight=yo,Ur.first=Vs,ic(Ur,function(){var e={};return yn(Ur,(function(t,r){Ae.call(Ur.prototype,r)||(e[r]=t)})),e}(),{chain:!1}),Ur.VERSION="4.17.21",It(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ur[e].placeholder=Ur})),It(["drop","take"],(function(e,t){Lr.prototype[e]=function(n){n=n===r?1:dr(la(n),0);var i=this.__filtered__&&!t?new Lr(this):this.clone();return i.__filtered__?i.__takeCount__=fr(n,i.__takeCount__):i.__views__.push({size:fr(n,l),type:e+(i.__dir__<0?"Right":"")}),i},Lr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),It(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;Lr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ns(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),It(["head","last"],(function(e,t){var r="take"+(t?"Right":"");Lr.prototype[e]=function(){return this[r](1).value()[0]}})),It(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");Lr.prototype[e]=function(){return this.__filtered__?new Lr(this):this[r](1)}})),Lr.prototype.compact=function(){return this.filter(ec)},Lr.prototype.find=function(e){return this.filter(e).head()},Lr.prototype.findLast=function(e){return this.reverse().find(e)},Lr.prototype.invokeMap=Fn((function(e,t){return"function"==typeof e?new Lr(this):this.map((function(r){return On(r,e,t)}))})),Lr.prototype.reject=function(e){return this.filter(Ao(ns(e)))},Lr.prototype.slice=function(e,t){e=la(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Lr(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=la(t))<0?n.dropRight(-t):n.take(t-e)),n)},Lr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Lr.prototype.toArray=function(){return this.take(l)},yn(Lr.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),s=Ur[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);s&&(Ur.prototype[t]=function(){var t=this.__wrapped__,a=i?[1]:arguments,c=t instanceof Lr,u=a[0],h=c||zo(t),l=function(e){var t=s.apply(Ur,xt([e],a));return i&&p?t[0]:t};h&&n&&"function"==typeof u&&1!=u.length&&(c=h=!1);var p=this.__chain__,d=!!this.__actions__.length,f=o&&!p,g=c&&!d;if(!o&&h){t=g?t:new Lr(this);var y=e.apply(t,a);return y.__actions__.push({func:uo,args:[l],thisArg:r}),new qr(y,p)}return f&&g?e.apply(this,a):(y=this.thru(l),f?i?y.value()[0]:y.value():y)})})),It(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ne[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Ur.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(zo(i)?i:[],e)}return this[r]((function(r){return t.apply(zo(r)?r:[],e)}))}})),yn(Lr.prototype,(function(e,t){var r=Ur[t];if(r){var n=r.name+"";Ae.call(Or,n)||(Or[n]=[]),Or[n].push({name:t,func:r})}})),Or[Ui(r,2).name]=[{name:"wrapper",func:r}],Lr.prototype.clone=function(){var e=new Lr(this.__wrapped__);return e.__actions__=Si(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Si(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Si(this.__views__),e},Lr.prototype.reverse=function(){if(this.__filtered__){var e=new Lr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Lr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=zo(e),n=t<0,i=r?e.length:0,s=function(e,t,r){for(var n=-1,i=r.length;++n=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},Ur.prototype.plant=function(e){for(var t,n=this;n instanceof $r;){var i=Us(n);i.__index__=0,i.__values__=r,t?s.__wrapped__=i:t=i;var s=i;n=n.__wrapped__}return s.__wrapped__=e,t},Ur.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Lr){var t=e;return this.__actions__.length&&(t=new Lr(this)),(t=t.reverse()).__actions__.push({func:uo,args:[Qs],thisArg:r}),new qr(t,this.__chain__)}return this.thru(Qs)},Ur.prototype.toJSON=Ur.prototype.valueOf=Ur.prototype.value=function(){return ui(this.__wrapped__,this.__actions__)},Ur.prototype.first=Ur.prototype.head,Qe&&(Ur.prototype[Qe]=function(){return this}),Ur}();lt?((lt.exports=hr)._=hr,ht._=hr):ut._=hr}).call(Ai)}(ji,ji.exports);var Di=Object.defineProperty,Ui=Object.defineProperties,ki=Object.getOwnPropertyDescriptors,$i=Object.getOwnPropertySymbols,qi=Object.prototype.hasOwnProperty,Li=Object.prototype.propertyIsEnumerable,Mi=(e,t,r)=>t in e?Di(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zi=(e,t)=>{for(var r in t||(t={}))qi.call(t,r)&&Mi(e,r,t[r]);if($i)for(var r of $i(t))Li.call(t,r)&&Mi(e,r,t[r]);return e},Vi=(e,t)=>Ui(e,ki(t));function Ki(e,t,r){let n;const i=Wi(e);return t.rpcMap&&(n=t.rpcMap[i]),n||(n=`https://rpc.walletconnect.com/v1?chainId=eip155:${i}&projectId=${r}`),n}function Wi(e){return e.includes("eip155")?Number(e.split(":")[1]):Number(e)}function Fi(e){return e.map((e=>`${e.split(":")[0]}:${e.split(":")[1]}`))}function Hi(e){var t,r,n,i;const s={};if(o=e,Object.getPrototypeOf(o)!==Object.prototype||!Object.keys(o).length)return s;var o;for(const[o,a]of Object.entries(e)){const e=Ii(o)?[o]:a.chains,c=a.methods||[],u=a.events||[],h=a.rpcMap||{},l=Si(o);s[l]=Vi(zi(zi({},s[l]),a),{chains:Ei(e,null==(t=s[l])?void 0:t.chains),methods:Ei(c,null==(r=s[l])?void 0:r.methods),events:Ei(u,null==(n=s[l])?void 0:n.events),rpcMap:zi(zi({},h),null==(i=s[l])?void 0:i.rpcMap)})}return s}function Bi(e){return e.includes(":")?e.split(":")[2]:e}function Ji(e){const t={};for(const[r,n]of Object.entries(e)){const e=n.methods||[],i=n.events||[],s=n.accounts||[],o=Ii(r)?[r]:n.chains?n.chains:Fi(n.accounts);t[r]={chains:o,methods:e,events:i,accounts:s}}return t}const Gi={},Qi=e=>Gi[e],Yi=(e,t)=>{Gi[e]=t};class Zi{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Qi("events"),this.client=Qi("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const r=t||Ki(`${this.name}:${e}`,this.namespace);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(Ti,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Ki(e,this.namespace);return typeof r>"u"?void 0:new nt.r(new Ri.Z(r,Qi("disableProviderPing")))}}class Xi{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Qi("events"),this.client=Qi("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){const r=Wi(e);if(!this.httpProviders[r]){const e=t||Ki(`${this.name}:${r}`,this.namespace,this.client.core.projectId);if(!e)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,e)}this.chainId=r,this.events.emit(Ti,`${this.name}:${r}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const r=t||Ki(`${this.name}:${e}`,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new nt.r(new Ri.k(r,Qi("disableProviderPing")))}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=Wi(t);e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,r;let n=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const i=parseInt(n,16);if(this.isChainApproved(i))this.setDefaultChain(`${i}`);else{if(!this.namespace.methods.includes("wallet_switchEthereumChain"))throw new Error(`Failed to switch to chain 'eip155:${i}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:null==(r=this.namespace.chains)?void 0:r[0]}),this.setDefaultChain(`${i}`)}return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}}class es{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Qi("events"),this.client=Qi("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const r=t||Ki(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.chainId=e,this.events.emit(Ti,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Ki(e,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new nt.r(new Ri.Z(r,Qi("disableProviderPing")))}}class ts{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Qi("events"),this.client=Qi("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const r=t||Ki(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(Ti,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Ki(e,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new nt.r(new Ri.Z(r,Qi("disableProviderPing")))}}class rs{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Qi("events"),this.client=Qi("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const r=t||this.getCardanoRPCUrl(e);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(Ti,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{const r=this.getCardanoRPCUrl(t);e[t]=this.createHttpProvider(t,r)})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||this.getCardanoRPCUrl(e);return typeof r>"u"?void 0:new nt.r(new Ri.Z(r,Qi("disableProviderPing")))}}class ns{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Qi("events"),this.client=Qi("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const r=t||Ki(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.chainId=e,this.events.emit(Ti,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Ki(e,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new nt.r(new Ri.Z(r,Qi("disableProviderPing")))}}class is{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Qi("events"),this.client=Qi("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const r=t||Ki(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.chainId=e,this.events.emit(Ti,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Ki(e,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new nt.r(new Ri.Z(r,Qi("disableProviderPing")))}}var ss=Object.defineProperty,os=Object.defineProperties,as=Object.getOwnPropertyDescriptors,cs=Object.getOwnPropertySymbols,us=Object.prototype.hasOwnProperty,hs=Object.prototype.propertyIsEnumerable,ls=(e,t,r)=>t in e?ss(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ps=(e,t)=>{for(var r in t||(t={}))us.call(t,r)&&ls(e,r,t[r]);if(cs)for(var r of cs(t))hs.call(t,r)&&ls(e,r,t[r]);return e},ds=(e,t)=>os(e,as(t));class fs{constructor(e){this.events=new(i()),this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:(0,m.pino)((0,m.getDefaultLoggerOptions)({level:e?.logger||Ci})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new fs(e);return await t.initialize(),t}async request(e,t){const[r,n]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(r).request({request:ps({},e),chainId:`${r}:${n}`,topic:this.session.topic})}sendAsync(e,t,r){this.request(e,r).then((e=>t(null,e))).catch((e=>t(e,void 0)))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:Oi("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:r,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});r&&(this.uri=r,this.events.emit("display_uri",r)),await n().then((e=>{this.session=e,this.namespaces||(this.namespaces=Ji(e.namespaces),this.persist("namespaces",this.namespaces))})).catch((e=>{if(e.message!==ti)throw e;t++}))}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[r,n]=this.validateChain(e);this.getProvider(r).setDefaultChain(n,t)}catch(e){if(!/Please call connect/.test(e.message))throw e}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Ni(t)){for(const r of t)e.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await _i.init({logger:this.providerOpts.logger||Ci,relayUrl:this.providerOpts.relayUrl||"wss://relay.walletconnect.com",projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map((e=>Si(e))))];Yi("client",this.client),Yi("events",this.events),Yi("disableProviderPing",this.disableProviderPing),e.forEach((e=>{if(!this.session)return;const t=function(e,t){const r=Object.keys(t.namespaces).filter((t=>t.includes(e)));if(!r.length)return[];const n=[];return r.forEach((e=>{const r=t.namespaces[e].accounts;n.push(...r)})),n}(e,this.session),r=Fi(t),n=function(e={},t={}){const r=Hi(e),n=Hi(t);return ji.exports.merge(r,n)}(this.namespaces,this.optionalNamespaces),i=ds(ps({},n[e]),{accounts:t,chains:r});switch(e){case"eip155":this.rpcProviders[e]=new Xi({namespace:i});break;case"solana":this.rpcProviders[e]=new es({namespace:i});break;case"cosmos":this.rpcProviders[e]=new ts({namespace:i});break;case"polkadot":this.rpcProviders[e]=new Zi({namespace:i});break;case"cip34":this.rpcProviders[e]=new rs({namespace:i});break;case"elrond":this.rpcProviders[e]=new ns({namespace:i});break;case"multiversx":this.rpcProviders[e]=new is({namespace:i})}}))}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",(e=>{this.events.emit("session_ping",e)})),this.client.on("session_event",(e=>{const{params:t}=e,{event:r}=t;if("accountsChanged"===r.name){const e=r.data;e&&Ni(e)&&this.events.emit("accountsChanged",e.map(Bi))}else"chainChanged"===r.name?this.onChainChanged(t.chainId):this.events.emit(r.name,r.data);this.events.emit("session_event",e)})),this.client.on("session_update",(({topic:e,params:t})=>{var r;const{namespaces:n}=t,i=null==(r=this.client)?void 0:r.session.get(e);this.session=ds(ps({},i),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})})),this.client.on("session_delete",(async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",ds(ps({},Oi("USER_DISCONNECTED")),{data:e.topic}))})),this.on(Ti,(e=>{this.onChainChanged(e,!0)}))}getProvider(e){if(!this.rpcProviders[e])throw new Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach((e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])}))}setNamespaces(e){const{namespaces:t,optionalNamespaces:r,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),r&&Object.keys(r).length&&(this.optionalNamespaces=r),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",r)}validateChain(e){const[t,r]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,r];if(t&&!Object.keys(this.namespaces||{}).map((e=>Si(e))).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&r)return[t,r];const n=Si(Object.keys(this.namespaces)[0]);return[n,this.rpcProviders[n].getDefaultChain()]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){var r;if(!this.namespaces)return;const[n,i]=this.validateChain(e);t||this.getProvider(n).setDefaultChain(i),(null!=(r=this.namespaces[n])?r:this.namespaces[`${n}:${i}`]).defaultChain=i,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${xi}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${xi}/${e}`)}}const gs=fs,ys=["eth_sendTransaction","personal_sign"],ms=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],vs=["chainChanged","accountsChanged"],ws=["message","disconnect","connect"];var bs=Object.defineProperty,_s=Object.defineProperties,Es=Object.getOwnPropertyDescriptors,Is=Object.getOwnPropertySymbols,Ss=Object.prototype.hasOwnProperty,Ps=Object.prototype.propertyIsEnumerable,Os=(e,t,r)=>t in e?bs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ns=(e,t)=>{for(var r in t||(t={}))Ss.call(t,r)&&Os(e,r,t[r]);if(Is)for(var r of Is(t))Ps.call(t,r)&&Os(e,r,t[r]);return e},Rs=(e,t)=>_s(e,Es(t));function Cs(e){return Number(e[0].split(":")[1])}function xs(e){return`0x${e.toString(16)}`}class Ts{constructor(){this.events=new n.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY="wc@2:ethereum_provider:",this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new Ts;return await t.initialize(e),t}async request(e){return await this.signer.request(e,this.formatChainId(this.chainId))}sendAsync(e,t){this.signer.sendAsync(e,t,this.formatChainId(this.chainId))}get connected(){return!!this.signer.client&&this.signer.client.core.relayer.connected}get connecting(){return!!this.signer.client&&this.signer.client.core.relayer.connecting}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:r}=function(e){const{chains:t,optionalChains:r,methods:n,optionalMethods:i,events:s,optionalEvents:o,rpcMap:a}=e;if(!f(t))throw new Error("Invalid chains");const c={chains:t,methods:n||ys,events:s||vs,rpcMap:Ns({},t.length?{[Cs(t)]:a[Cs(t)]}:{})},u=s?.filter((e=>!vs.includes(e))),h=n?.filter((e=>!ys.includes(e)));if(!(r||o||i||null!=u&&u.length||null!=h&&h.length))return{required:t.length?c:void 0};const l={chains:[...new Set(u?.length&&h?.length||!r?c.chains.concat(r||[]):r)],methods:[...new Set(c.methods.concat(null!=i&&i.length?i:ms))],events:[...new Set(c.events.concat(o||ws))],rpcMap:a};return{required:t.length?c:void 0,optional:r.length?l:void 0}}(this.rpc);try{const n=await new Promise((async(n,i)=>{var s;this.rpc.showQrModal&&(null==(s=this.modal)||s.subscribeModal((e=>{!e.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),i(new Error("Connection request reset. Please try again.")))}))),await this.signer.connect(Rs(Ns({namespaces:Ns({},t&&{[this.namespace]:t})},r&&{optionalNamespaces:{[this.namespace]:r}}),{pairingTopic:e?.pairingTopic})).then((e=>{n(e)})).catch((e=>{i(new Error(e.message))}))}));if(!n)return;this.setChainIds(this.rpc.chains);const i=function(e,t=[]){const r=[];return Object.keys(e).forEach((n=>{if(t.length&&!t.includes(n))return;const i=e[n];r.push(...i.accounts)})),r}(n.namespaces,[this.namespace]);this.setAccounts(i),this.events.emit("connect",{chainId:xs(this.chainId)})}catch(e){throw this.signer.logger.error(e),e}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",(e=>{const{params:t}=e,{event:r}=t;"accountsChanged"===r.name?(this.accounts=this.parseAccounts(r.data),this.events.emit("accountsChanged",this.accounts)):"chainChanged"===r.name?this.setChainId(this.formatChainId(r.data)):this.events.emit(r.name,r.data),this.events.emit("session_event",e)})),this.signer.on("chainChanged",(e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",xs(this.chainId)),this.persist()})),this.signer.on("session_update",(e=>{this.events.emit("session_update",e)})),this.signer.on("session_delete",(e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",Rs(Ns({},function(e,t){const{message:r,code:n}=d[e];return{message:t?`${r} ${t}`:r,code:n}}("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))})),this.signer.on("display_uri",(e=>{var t,r;this.rpc.showQrModal&&(null==(t=this.modal)||t.closeModal(),null==(r=this.modal)||r.openModal({uri:e})),this.events.emit("display_uri",e)}))}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return"string"==typeof e&&e.startsWith(`${this.namespace}:`)}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter((e=>this.isCompatibleChainId(e))).map((e=>this.parseChainId(e)));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",xs(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,r,n]=e.split(":");return{chainId:`${t}:${r}`,address:n}}setAccounts(e){this.accounts=e.filter((e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId)).map((e=>this.parseAccountId(e).address)),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,r;const n=null!=(t=e?.chains)?t:[],i=null!=(r=e?.optionalChains)?r:[],s=n.concat(i);if(!s.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const o=n.length?e?.methods||ys:[],a=n.length?e?.events||vs:[],c=e?.optionalMethods||[],u=e?.optionalEvents||[],h=e?.rpcMap||this.buildRpcMap(s,e.projectId),l=e?.qrModalOptions||void 0;return{chains:n?.map((e=>this.formatChainId(e))),optionalChains:i.map((e=>this.formatChainId(e))),methods:o,events:a,optionalMethods:c,optionalEvents:u,rpcMap:h,showQrModal:!(null==e||!e.showQrModal),qrModalOptions:l,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const r={};return e.forEach((e=>{r[e]=this.getRpcUrl(e,t)})),r}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?Cs(this.rpc.chains):Cs(this.rpc.optionalChains),this.signer=await gs.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let e;try{const{WalletConnectModal:t}=await r.e(9343).then(r.bind(r,59343));e=t}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(e)try{this.modal=new e(Ns({walletConnectVersion:2,projectId:this.rpc.projectId,standaloneChains:this.rpc.chains},this.rpc.qrModalOptions))}catch(e){throw this.signer.logger.error(e),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:r,rpcMap:n}=e;t&&f(t)&&(this.rpc.chains=t.map((e=>this.formatChainId(e))),t.forEach((e=>{this.rpc.rpcMap[e]=n?.[e]||this.getRpcUrl(e)}))),r&&f(r)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=r?.map((e=>this.formatChainId(e))),r.forEach((e=>{this.rpc.rpcMap[e]=n?.[e]||this.getRpcUrl(e)})))}getRpcUrl(e,t){var r;return(null==(r=this.rpc.rpcMap)?void 0:r[e])||`https://rpc.walletconnect.com/v1/?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return"string"==typeof e||e instanceof String?[this.parseAccount(e)]:e.map((e=>this.parseAccount(e)))}}},62116:(e,t)=>{function r(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function n(e){const t=r(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=r,t.getFromWindowOrThrow=n,t.getDocumentOrThrow=function(){return n("document")},t.getDocument=function(){return r("document")},t.getNavigatorOrThrow=function(){return n("navigator")},t.getNavigator=function(){return r("navigator")},t.getLocationOrThrow=function(){return n("location")},t.getLocation=function(){return r("location")},t.getCryptoOrThrow=function(){return n("crypto")},t.getCrypto=function(){return r("crypto")},t.getLocalStorageOrThrow=function(){return n("localStorage")},t.getLocalStorage=function(){return r("localStorage")}},304:(e,t,r)=>{r(62116)},87283:(e,t,r)=>{const n=r(70610),i=r(44020),s=r(80500),o=r(92806),a=Symbol("encodeFragmentIdentifier");function c(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function u(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function h(e,t){return t.decode?i(e):e}function l(e){return Array.isArray(e)?e.sort():"object"==typeof e?l(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function p(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=p(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function g(e,t){c((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"colon-list-separator":return(e,r,n)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const i="string"==typeof r&&r.includes(e.arrayFormatSeparator),s="string"==typeof r&&!i&&h(r,e).includes(e.arrayFormatSeparator);r=s?h(r,e):r;const o=i||s?r.split(e.arrayFormatSeparator).map((t=>h(t,e))):null===r?r:h(r,e);n[t]=o};case"bracket-separator":return(t,r,n)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(n[t]=r?h(r,e):r);const s=null===r?[]:r.split(e.arrayFormatSeparator).map((t=>h(t,e)));void 0!==n[t]?n[t]=[].concat(n[t],s):n[t]=s};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const i of e.split("&")){if(""===i)continue;let[e,o]=s(t.decode?i.replace(/\+/g," "):i,"=");o=void 0===o?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?o:h(o,t),r(h(e,t),o,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=f(r[e],t);else n[e]=f(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce(((e,t)=>{const r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=l(r):e[t]=r,e}),Object.create(null))}t.extract=d,t.parse=g,t.stringify=(e,t)=>{if(!e)return"";c((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const i=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[u(t,e),"[",i,"]"].join("")]:[...r,[u(t,e),"[",u(i,e),"]=",u(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[u(t,e),"[]"].join("")]:[...r,[u(t,e),"[]=",u(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[u(t,e),":list="].join("")]:[...r,[u(t,e),":list=",u(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return r=>(n,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?n:(i=null===i?"":i,0===n.length?[[u(r,e),t,u(i,e)].join("")]:[[n,u(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,u(t,e)]:[...r,[u(t,e),"=",u(n,e)].join("")]}}(t),i={};for(const t of Object.keys(e))r(t)||(i[t]=e[t]);const s=Object.keys(i);return!1!==t.sort&&s.sort(t.sort),s.map((r=>{const i=e[r];return void 0===i?"":null===i?u(r,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?u(r,t)+"[]":i.reduce(n(r),[]).join("&"):u(r,t)+"="+u(i,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=s(e,"#");return Object.assign({url:r.split("?")[0]||"",query:g(d(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:h(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0,[a]:!0},r);const n=p(e.url).split("?")[0]||"",i=t.extract(e.url),s=t.parse(i,{sort:!1}),o=Object.assign(s,e.query);let c=t.stringify(o,r);c&&(c=`?${c}`);let h=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(h=`#${r[a]?u(e.fragmentIdentifier,r):e.fragmentIdentifier}`),`${n}${c}${h}`},t.pick=(e,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0,[a]:!1},n);const{url:i,query:s,fragmentIdentifier:c}=t.parseUrl(e,n);return t.stringifyUrl({url:i,query:o(s,r),fragmentIdentifier:c},n)},t.exclude=(e,r,n)=>{const i=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return t.pick(e,i,n)}},72030:e=>{e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},18495:(e,t)=>{function r(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function n(e){const t=r(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=r,t.getFromWindowOrThrow=n,t.getDocumentOrThrow=function(){return n("document")},t.getDocument=function(){return r("document")},t.getNavigatorOrThrow=function(){return n("navigator")},t.getNavigator=function(){return r("navigator")},t.getLocationOrThrow=function(){return n("location")},t.getLocation=function(){return r("location")},t.getCryptoOrThrow=function(){return n("crypto")},t.getCrypto=function(){return r("crypto")},t.getLocalStorageOrThrow=function(){return n("localStorage")},t.getLocalStorage=function(){return r("localStorage")}},20416:(e,t,r)=>{t.D=void 0;const n=r(18495);t.D=function(){let e,t;try{e=n.getDocumentOrThrow(),t=n.getLocationOrThrow()}catch(e){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;en.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(i.length&&i){const e=n.getAttribute("content");if(e)return e}}return""}const i=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:r("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const r=e.getElementsByTagName("link"),n=[];for(let e=0;e-1){const e=i.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{const n=t.pathname.split("/");n.pop(),r+=n.join("/")+"/"+e}n.push(r)}else if(0===e.indexOf("//")){const r=t.protocol+e;n.push(r)}else n.push(e)}}return n}(),name:i}}},87338:(e,t,r)=>{const n=r(70610),i=r(44020),s=r(80500),o=r(92806),a=Symbol("encodeFragmentIdentifier");function c(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function u(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function h(e,t){return t.decode?i(e):e}function l(e){return Array.isArray(e)?e.sort():"object"==typeof e?l(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function p(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=p(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function g(e,t){c((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"colon-list-separator":return(e,r,n)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const i="string"==typeof r&&r.includes(e.arrayFormatSeparator),s="string"==typeof r&&!i&&h(r,e).includes(e.arrayFormatSeparator);r=s?h(r,e):r;const o=i||s?r.split(e.arrayFormatSeparator).map((t=>h(t,e))):null===r?r:h(r,e);n[t]=o};case"bracket-separator":return(t,r,n)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(n[t]=r?h(r,e):r);const s=null===r?[]:r.split(e.arrayFormatSeparator).map((t=>h(t,e)));void 0!==n[t]?n[t]=[].concat(n[t],s):n[t]=s};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const i of e.split("&")){if(""===i)continue;let[e,o]=s(t.decode?i.replace(/\+/g," "):i,"=");o=void 0===o?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?o:h(o,t),r(h(e,t),o,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=f(r[e],t);else n[e]=f(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce(((e,t)=>{const r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=l(r):e[t]=r,e}),Object.create(null))}t.extract=d,t.parse=g,t.stringify=(e,t)=>{if(!e)return"";c((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const i=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[u(t,e),"[",i,"]"].join("")]:[...r,[u(t,e),"[",u(i,e),"]=",u(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[u(t,e),"[]"].join("")]:[...r,[u(t,e),"[]=",u(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[u(t,e),":list="].join("")]:[...r,[u(t,e),":list=",u(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return r=>(n,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?n:(i=null===i?"":i,0===n.length?[[u(r,e),t,u(i,e)].join("")]:[[n,u(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,u(t,e)]:[...r,[u(t,e),"=",u(n,e)].join("")]}}(t),i={};for(const t of Object.keys(e))r(t)||(i[t]=e[t]);const s=Object.keys(i);return!1!==t.sort&&s.sort(t.sort),s.map((r=>{const i=e[r];return void 0===i?"":null===i?u(r,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?u(r,t)+"[]":i.reduce(n(r),[]).join("&"):u(r,t)+"="+u(i,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=s(e,"#");return Object.assign({url:r.split("?")[0]||"",query:g(d(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:h(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0,[a]:!0},r);const n=p(e.url).split("?")[0]||"",i=t.extract(e.url),s=t.parse(i,{sort:!1}),o=Object.assign(s,e.query);let c=t.stringify(o,r);c&&(c=`?${c}`);let h=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(h=`#${r[a]?u(e.fragmentIdentifier,r):e.fragmentIdentifier}`),`${n}${c}${h}`},t.pick=(e,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0,[a]:!1},n);const{url:i,query:s,fragmentIdentifier:c}=t.parseUrl(e,n);return t.stringifyUrl({url:i,query:o(s,r),fragmentIdentifier:c},n)},t.exclude=(e,r,n)=>{const i=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return t.pick(e,i,n)}},3382:(e,t)=>{function r(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function n(e){const t=r(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=r,t.getFromWindowOrThrow=n,t.getDocumentOrThrow=function(){return n("document")},t.getDocument=function(){return r("document")},t.getNavigatorOrThrow=function(){return n("navigator")},t.getNavigator=function(){return r("navigator")},t.getLocationOrThrow=function(){return n("location")},t.getLocation=function(){return r("location")},t.getCryptoOrThrow=function(){return n("crypto")},t.getCrypto=function(){return r("crypto")},t.getLocalStorageOrThrow=function(){return n("localStorage")},t.getLocalStorage=function(){return r("localStorage")}},99982:(e,t,r)=>{r(3382)},94543:(e,t,r)=>{const n=r(70610),i=r(44020),s=r(80500),o=r(92806),a=Symbol("encodeFragmentIdentifier");function c(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function u(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function h(e,t){return t.decode?i(e):e}function l(e){return Array.isArray(e)?e.sort():"object"==typeof e?l(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function p(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=p(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function g(e,t){c((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"colon-list-separator":return(e,r,n)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const i="string"==typeof r&&r.includes(e.arrayFormatSeparator),s="string"==typeof r&&!i&&h(r,e).includes(e.arrayFormatSeparator);r=s?h(r,e):r;const o=i||s?r.split(e.arrayFormatSeparator).map((t=>h(t,e))):null===r?r:h(r,e);n[t]=o};case"bracket-separator":return(t,r,n)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(n[t]=r?h(r,e):r);const s=null===r?[]:r.split(e.arrayFormatSeparator).map((t=>h(t,e)));void 0!==n[t]?n[t]=[].concat(n[t],s):n[t]=s};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const i of e.split("&")){if(""===i)continue;let[e,o]=s(t.decode?i.replace(/\+/g," "):i,"=");o=void 0===o?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?o:h(o,t),r(h(e,t),o,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=f(r[e],t);else n[e]=f(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce(((e,t)=>{const r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=l(r):e[t]=r,e}),Object.create(null))}t.extract=d,t.parse=g,t.stringify=(e,t)=>{if(!e)return"";c((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const i=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[u(t,e),"[",i,"]"].join("")]:[...r,[u(t,e),"[",u(i,e),"]=",u(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[u(t,e),"[]"].join("")]:[...r,[u(t,e),"[]=",u(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[u(t,e),":list="].join("")]:[...r,[u(t,e),":list=",u(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return r=>(n,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?n:(i=null===i?"":i,0===n.length?[[u(r,e),t,u(i,e)].join("")]:[[n,u(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,u(t,e)]:[...r,[u(t,e),"=",u(n,e)].join("")]}}(t),i={};for(const t of Object.keys(e))r(t)||(i[t]=e[t]);const s=Object.keys(i);return!1!==t.sort&&s.sort(t.sort),s.map((r=>{const i=e[r];return void 0===i?"":null===i?u(r,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?u(r,t)+"[]":i.reduce(n(r),[]).join("&"):u(r,t)+"="+u(i,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=s(e,"#");return Object.assign({url:r.split("?")[0]||"",query:g(d(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:h(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0,[a]:!0},r);const n=p(e.url).split("?")[0]||"",i=t.extract(e.url),s=t.parse(i,{sort:!1}),o=Object.assign(s,e.query);let c=t.stringify(o,r);c&&(c=`?${c}`);let h=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(h=`#${r[a]?u(e.fragmentIdentifier,r):e.fragmentIdentifier}`),`${n}${c}${h}`},t.pick=(e,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0,[a]:!1},n);const{url:i,query:s,fragmentIdentifier:c}=t.parseUrl(e,n);return t.stringifyUrl({url:i,query:o(s,r),fragmentIdentifier:c},n)},t.exclude=(e,r,n)=>{const i=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return t.pick(e,i,n)}}}]); \ No newline at end of file diff --git a/gateway/dist/6883.7bcffa849dba91c44f70.bundle.js b/gateway/dist/1234.45819a346281db80fbd9.bundle.js similarity index 99% rename from gateway/dist/6883.7bcffa849dba91c44f70.bundle.js rename to gateway/dist/1234.45819a346281db80fbd9.bundle.js index 2c04e090..c0c3216c 100644 --- a/gateway/dist/6883.7bcffa849dba91c44f70.bundle.js +++ b/gateway/dist/1234.45819a346281db80fbd9.bundle.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[6883],{46883:(e,i,r)=>{r.r(i),r.d(i,{default:()=>n});const n='\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'}}]); \ No newline at end of file +"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[1234],{31234:(e,i,r)=>{r.r(i),r.d(i,{default:()=>n});const n='\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'}}]); \ No newline at end of file diff --git a/gateway/dist/1330.b3527ff21b477fd9d743.bundle.js b/gateway/dist/1330.b3527ff21b477fd9d743.bundle.js new file mode 100644 index 00000000..caf9fd6d --- /dev/null +++ b/gateway/dist/1330.b3527ff21b477fd9d743.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[1330],{1330:(C,e,t)=>{t.r(e),t.d(e,{default:()=>s});const s='\n\n\n\n'}}]); \ No newline at end of file diff --git a/gateway/dist/4008.b7736b49344fb50102b1.bundle.js b/gateway/dist/1355.5da6953679170f874a61.bundle.js similarity index 92% rename from gateway/dist/4008.b7736b49344fb50102b1.bundle.js rename to gateway/dist/1355.5da6953679170f874a61.bundle.js index 65f74689..0d0d4e0f 100644 --- a/gateway/dist/4008.b7736b49344fb50102b1.bundle.js +++ b/gateway/dist/1355.5da6953679170f874a61.bundle.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[4008],{54008:(s,C,e)=>{e.r(C),e.d(C,{default:()=>w});const w='\n\n\n'}}]); \ No newline at end of file +"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[1355],{41355:(s,C,e)=>{e.r(C),e.d(C,{default:()=>w});const w='\n\n\n'}}]); \ No newline at end of file diff --git a/gateway/dist/5221.b97cad8db82198377b1c.bundle.js b/gateway/dist/1452.b0471f4475fc6e0622af.bundle.js similarity index 97% rename from gateway/dist/5221.b97cad8db82198377b1c.bundle.js rename to gateway/dist/1452.b0471f4475fc6e0622af.bundle.js index 12369fb5..ab2a9124 100644 --- a/gateway/dist/5221.b97cad8db82198377b1c.bundle.js +++ b/gateway/dist/1452.b0471f4475fc6e0622af.bundle.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[5221],{25221:(t,n,i)=>{i.r(n),i.d(n,{default:()=>e});const e='\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n'}}]); \ No newline at end of file +"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[1452],{71452:(t,n,i)=>{i.r(n),i.d(n,{default:()=>e});const e='\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n'}}]); \ No newline at end of file diff --git a/gateway/dist/1538.41b23ed9cc4362bbb783.bundle.js b/gateway/dist/1538.41b23ed9cc4362bbb783.bundle.js new file mode 100644 index 00000000..cfeee3c3 --- /dev/null +++ b/gateway/dist/1538.41b23ed9cc4362bbb783.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[1538],{1538:(e,t,a)=>{a.r(t),a.d(t,{default:()=>s});const s='Coin98'}}]); \ No newline at end of file diff --git a/gateway/dist/1837.1a25b8a749e0f19f2ae4.bundle.js b/gateway/dist/1837.1a25b8a749e0f19f2ae4.bundle.js new file mode 100644 index 00000000..2c8578f5 --- /dev/null +++ b/gateway/dist/1837.1a25b8a749e0f19f2ae4.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[1837],{81837:(n,C,e)=>{e.r(C),e.d(C,{default:()=>t});const t='\n\n\n\n\n\n\n \n \n \n \n\n'}}]); \ No newline at end of file diff --git a/gateway/dist/6316.c572059b53edacecfece.bundle.js b/gateway/dist/1948.9d9d13821d34fb44e6a9.bundle.js similarity index 99% rename from gateway/dist/6316.c572059b53edacecfece.bundle.js rename to gateway/dist/1948.9d9d13821d34fb44e6a9.bundle.js index 90681860..cefae21d 100644 --- a/gateway/dist/6316.c572059b53edacecfece.bundle.js +++ b/gateway/dist/1948.9d9d13821d34fb44e6a9.bundle.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[6316],{66316:(e,a,t)=>{t.r(a),t.d(a,{default:()=>i});const i='\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'}}]); \ No newline at end of file +"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[1948],{31948:(e,a,t)=>{t.r(a),t.d(a,{default:()=>i});const i='\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'}}]); \ No newline at end of file diff --git a/gateway/dist/1956.9dbf81582193eb8ed106.bundle.js b/gateway/dist/1956.9dbf81582193eb8ed106.bundle.js deleted file mode 100644 index 7562fecf..00000000 --- a/gateway/dist/1956.9dbf81582193eb8ed106.bundle.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[1956],{71956:(C,l,t)=>{t.r(l),t.d(l,{default:()=>n});const n='\nIcons/Illustrations/Logo_40x40_white_background\n\n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n'}}]); \ No newline at end of file diff --git a/gateway/dist/2522.82c4094c6359ff79d6e9.bundle.js b/gateway/dist/2131.cac4250904cbb3352b7e.bundle.js similarity index 98% rename from gateway/dist/2522.82c4094c6359ff79d6e9.bundle.js rename to gateway/dist/2131.cac4250904cbb3352b7e.bundle.js index 9733ed63..9f2e6572 100644 --- a/gateway/dist/2522.82c4094c6359ff79d6e9.bundle.js +++ b/gateway/dist/2131.cac4250904cbb3352b7e.bundle.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[2522],{12522:(e,l,o)=>{o.r(l),o.d(l,{default:()=>n});const n='\n\n\n\n\n\n\n\n\n\n\n\n\n'}}]); \ No newline at end of file +"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[2131],{42131:(e,l,o)=>{o.r(l),o.d(l,{default:()=>n});const n='\n\n\n\n\n\n\n\n\n\n\n\n\n'}}]); \ No newline at end of file diff --git a/gateway/dist/2182.230a6ca9fd5fe56dde35.bundle.js b/gateway/dist/2182.230a6ca9fd5fe56dde35.bundle.js deleted file mode 100644 index 34fd8a38..00000000 --- a/gateway/dist/2182.230a6ca9fd5fe56dde35.bundle.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[2182],{92182:(e,l,t)=>{t.r(l),t.d(l,{default:()=>s});const s='\n\n\n\n'}}]); \ No newline at end of file diff --git a/gateway/dist/2526.5fb06436fd3e9730bc58.bundle.js b/gateway/dist/2526.5fb06436fd3e9730bc58.bundle.js new file mode 100644 index 00000000..9b96c412 --- /dev/null +++ b/gateway/dist/2526.5fb06436fd3e9730bc58.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[2526],{52526:(n,i,t)=>{t.r(i),t.d(i,{default:()=>e});const e='\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'}}]); \ No newline at end of file diff --git a/gateway/dist/2687.854f324ad04dc2a8dc0b.bundle.js b/gateway/dist/2687.854f324ad04dc2a8dc0b.bundle.js new file mode 100644 index 00000000..11391e4a --- /dev/null +++ b/gateway/dist/2687.854f324ad04dc2a8dc0b.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[2687],{62687:(c,n,s)=>{s.r(n),s.d(n,{default:()=>l});const l='\n\n\x3c!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n\n'}}]); \ No newline at end of file diff --git a/gateway/dist/270.1c6c511008155fa6c355.bundle.js b/gateway/dist/270.1c6c511008155fa6c355.bundle.js deleted file mode 100644 index df6cfd88..00000000 --- a/gateway/dist/270.1c6c511008155fa6c355.bundle.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[270],{70270:(t,e,i)=>{"use strict";i.d(e,{default:()=>Bt});var r={};i.r(r),i.d(r,{decrypt:()=>Lt,encrypt:()=>Nt,generateKey:()=>Ct,verifyHmac:()=>jt});var n=i(65755),s=i(62873),o=i(34155),h=function(){for(var t=0,e=0,i=arguments.length;ee=e.concat(Array.from(t)))),new Uint8Array([...e])}function J(t,e=8,i=L){return function(t,e,i=L){return function(t,e,i,r=L){const n=e-t.length;let s=t;if(n>0){const e=r.repeat(n);s=i?e+t:t+e}return s}(t,e,!0,i)}(t,function(t,e=8){const i=t%e;return i?(t-i)/e*e+e:t}(t.length,e),i)}function K(t){return t.replace(/^0x/,"")}function z(t){return t.startsWith("0x")?t:`0x${t}`}function Q(t){return(t=J(t=K(t),2))&&(t=z(t)),t}function V(t){return U(new Uint8Array(t))}function H(t,e){const i=K(Q(new(A())(t).toString(16)));return e?i:z(i)}var X=i(91094);function G(t){return Q(t)}const Y=i(56186).payloadId;function tt(){return((t,e)=>{for(e=t="";t++<36;e+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return e})()}function et(t,e){return function(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}(t,e)}function it(t){return void 0!==t.result}function rt(t){return void 0!==t.error}function nt(t){return void 0!==t.event}function st(t){var e,i;return(e=t)&&e.length&&!et(t[0])&&(t[0]=function(t,e=!1){return W(D(t),e)}(t[0],!i)),t}function ot(t){if(void 0!==t.type&&"0"!==t.type)return t;if(void 0===t.from||!(e=t.from)||"0x"!==e.toLowerCase().substring(0,2)||!/^(0x)?[0-9a-f]{40}$/i.test(e)||!/^(0x)?[0-9a-f]{40}$/.test(e)&&!/^(0x)?[0-9A-F]{40}$/.test(e)&&e!==function(t){t=K(t.toLowerCase());const e=K((0,X.keccak_256)(D(t)));let i="";for(let r=0;r7?i+=t[r].toUpperCase():i+=t[r];return z(i)}(e))throw new Error("Transaction object must include a valid 'from' value.");var e;function i(t){let e=t;return("number"==typeof t||"string"==typeof t&&!function(t){return""===t||"string"==typeof t&&""===t.trim()}(t))&&(et(t)?"string"==typeof t&&(e=G(t)):e=H(t)),"string"==typeof e&&(e=function(t){const e=t.startsWith("0x");return t=(t=K(t)).startsWith(L)?t.substring(1):t,e?z(t):t}(z(e))),e}const r={from:G(t.from),to:void 0===t.to?void 0:G(t.to),gasPrice:void 0===t.gasPrice?"":i(t.gasPrice),gas:void 0===t.gas?void 0===t.gasLimit?"":i(t.gasLimit):i(t.gas),value:void 0===t.value?"":i(t.value),nonce:void 0===t.nonce?"":i(t.nonce),data:void 0===t.data?"":G(t.data)||"0x"},n=["gasPrice","gas","value","nonce"];return Object.keys(r).forEach((t=>{(void 0===r[t]||"string"==typeof r[t]&&!r[t].trim().length)&&n.includes(t)&&delete r[t]})),r}var ht=i(17563);function at(t){return ht.parse(t)}const ut=class{constructor(){this._eventEmitters=[],"undefined"!=typeof window&&void 0!==window.addEventListener&&(window.addEventListener("online",(()=>this.trigger("online"))),window.addEventListener("offline",(()=>this.trigger("offline"))))}on(t,e){this._eventEmitters.push({event:t,callback:e})}trigger(t){let e=[];t&&(e=this._eventEmitters.filter((e=>e.event===t))),e.forEach((t=>{t.callback()}))}},ct=void 0!==i.g.WebSocket?i.g.WebSocket:i(68007),lt=class{constructor(t){if(this.opts=t,this._queue=[],this._events=[],this._subscriptions=[],this._protocol=t.protocol,this._version=t.version,this._url="",this._netMonitor=null,this._socket=null,this._nextSocket=null,this._subscriptions=t.subscriptions||[],this._netMonitor=t.netMonitor||new ut,!t.url||"string"!=typeof t.url)throw new Error("Missing or invalid WebSocket url");this._url=t.url,this._netMonitor.on("online",(()=>this._socketCreate()))}set readyState(t){}get readyState(){return this._socket?this._socket.readyState:-1}set connecting(t){}get connecting(){return 0===this.readyState}set connected(t){}get connected(){return 1===this.readyState}set closing(t){}get closing(){return 2===this.readyState}set closed(t){}get closed(){return 3===this.readyState}open(){this._socketCreate()}close(){this._socketClose()}send(t,e,i){if(!e||"string"!=typeof e)throw new Error("Missing or invalid topic field");this._socketSend({topic:e,type:"pub",payload:t,silent:!!i})}subscribe(t){this._socketSend({topic:t,type:"sub",payload:"",silent:!0})}on(t,e){this._events.push({event:t,callback:e})}_socketCreate(){if(this._nextSocket)return;const t=function(t,e,i){var r,n;const s=(t.startsWith("https")?t.replace("https","wss"):t.startsWith("http")?t.replace("http","ws"):t).split("?"),o=!function(){const t=w();return!(!t||!t.name)&&"node"===t.name.toLowerCase()}()&&y()?{protocol:e,version:i,env:"browser",host:(null===(r=_())||void 0===r?void 0:r.host)||""}:{protocol:e,version:i,env:(null===(n=w())||void 0===n?void 0:n.name)||""},h=function(t,e){let i=at(t);return i=Object.assign(Object.assign({},i),e),t=function(t){return ht.stringify(t)}(i),t}(function(t){const e=-1!==t.indexOf("?")?t.indexOf("?"):void 0;return void 0!==e?t.substr(e):""}(s[1]||""),o);return s[0]+"?"+h}(this._url,this._protocol,this._version);if(this._nextSocket=new ct(t),!this._nextSocket)throw new Error("Failed to create socket");this._nextSocket.onmessage=t=>this._socketReceive(t),this._nextSocket.onopen=()=>this._socketOpen(),this._nextSocket.onerror=t=>this._socketError(t),this._nextSocket.onclose=()=>{setTimeout((()=>{this._nextSocket=null,this._socketCreate()}),1e3)}}_socketOpen(){this._socketClose(),this._socket=this._nextSocket,this._nextSocket=null,this._queueSubscriptions(),this._pushQueue()}_socketClose(){this._socket&&(this._socket.onclose=()=>{},this._socket.close())}_socketSend(t){const e=JSON.stringify(t);this._socket&&1===this._socket.readyState?this._socket.send(e):(this._setToQueue(t),this._socketCreate())}async _socketReceive(t){let e;try{e=JSON.parse(t.data)}catch(t){return}if(this._socketSend({topic:e.topic,type:"ack",payload:"",silent:!0}),this._socket&&1===this._socket.readyState){const t=this._events.filter((t=>"message"===t.event));t&&t.length&&t.forEach((t=>t.callback(e)))}}_socketError(t){const e=this._events.filter((t=>"error"===t.event));e&&e.length&&e.forEach((e=>e.callback(t)))}_queueSubscriptions(){this._subscriptions.forEach((t=>this._queue.push({topic:t,type:"sub",payload:"",silent:!0}))),this._subscriptions=this.opts.subscriptions||[]}_setToQueue(t){this._queue.push(t)}_pushQueue(){this._queue.forEach((t=>this._socketSend(t))),this._queue=[]}},dt="Session currently connected",pt="Session currently disconnected",ft="JSON RPC response format is invalid",mt="User close QRCode Modal",gt=class{constructor(){this._eventEmitters=[]}subscribe(t){this._eventEmitters.push(t)}unsubscribe(t){this._eventEmitters=this._eventEmitters.filter((e=>e.event!==t))}trigger(t){let e,i=[];e=void 0!==t.method?t.method:it(t)||rt(t)?`response:${t.id}`:nt(t)?t.event:"",e&&(i=this._eventEmitters.filter((t=>t.event===e))),i&&i.length||function(t){return R.includes(t)||t.startsWith("wc_")}(e)||nt(e)||(i=this._eventEmitters.filter((t=>"call_request"===t.event))),i.forEach((e=>{if(rt(t)){const i=new Error(t.error.message);e.callback(i,null)}else e.callback(null,t)}))}},vt=class{constructor(t="walletconnect"){this.storageId=t}getSession(){let t=null;const e=S(this.storageId);return e&&void 0!==e.bridge&&(t=e),t}setSession(t){return function(t,e){const i="string"==typeof(n=e)?n:JSON.stringify(n),r=b();var n;r&&r.setItem(t,i)}(this.storageId,t),t}removeSession(){I(this.storageId)}},wt="abcdefghijklmnopqrstuvwxyz0123456789".split("").map((t=>`https://${t}.bridge.walletconnect.org`));function Mt(t){return function(t){return"walletconnect.org"===function(t){return function(t){let e=t.indexOf("//")>-1?t.split("/")[2]:t.split("/")[0];return e=e.split(":")[0],e=e.split("?")[0],e}(t).split(".").slice(-2).join(".")}(t)}(t)?wt[Math.floor(Math.random()*wt.length)]:t}const yt=class{constructor(t){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new gt,this._clientMeta=k()||t.connectorOpts.clientMeta||null,this._cryptoLib=t.cryptoLib,this._sessionStorage=t.sessionStorage||new vt(t.connectorOpts.storageId),this._qrcodeModal=t.connectorOpts.qrcodeModal,this._qrcodeModalOptions=t.connectorOpts.qrcodeModalOptions,this._signingMethods=[...T,...t.connectorOpts.signingMethods||[]],!t.connectorOpts.bridge&&!t.connectorOpts.uri&&!t.connectorOpts.session)throw new Error("Missing one of the required parameters: bridge / uri / session");t.connectorOpts.bridge&&(this.bridge=Mt(t.connectorOpts.bridge)),t.connectorOpts.uri&&(this.uri=t.connectorOpts.uri);const e=t.connectorOpts.session||this._getStorageSession();e&&(this.session=e),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=t.transport||new lt({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),t.connectorOpts.uri&&this._subscribeToSessionRequest(),t.pushServerOpts&&this._registerPushServer(t.pushServerOpts)}set bridge(t){t&&(this._bridge=t)}get bridge(){return this._bridge}set key(t){if(!t)return;const e=$(t).buffer;this._key=e}get key(){return this._key?(t=this._key,!0,P(new Uint8Array(t),!1)):"";var t}set clientId(t){t&&(this._clientId=t)}get clientId(){let t=this._clientId;return t||(t=this._clientId=tt()),this._clientId}set peerId(t){t&&(this._peerId=t)}get peerId(){return this._peerId}set clientMeta(t){}get clientMeta(){let t=this._clientMeta;return t||(t=this._clientMeta=k()),t}set peerMeta(t){this._peerMeta=t}get peerMeta(){return this._peerMeta}set handshakeTopic(t){t&&(this._handshakeTopic=t)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(t){t&&(this._handshakeId=t)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(t){if(!t)return;const{handshakeTopic:e,bridge:i,key:r}=this._parseUri(t);this.handshakeTopic=e,this.bridge=i,this.key=r}set chainId(t){this._chainId=t}get chainId(){return this._chainId}set networkId(t){this._networkId=t}get networkId(){return this._networkId}set accounts(t){this._accounts=t}get accounts(){return this._accounts}set rpcUrl(t){this._rpcUrl=t}get rpcUrl(){return this._rpcUrl}set connected(t){}get connected(){return this._connected}set pending(t){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(t){t&&(this._connected=t.connected,this.accounts=t.accounts,this.chainId=t.chainId,this.bridge=t.bridge,this.key=t.key,this.clientId=t.clientId,this.clientMeta=t.clientMeta,this.peerId=t.peerId,this.peerMeta=t.peerMeta,this.handshakeId=t.handshakeId,this.handshakeTopic=t.handshakeTopic)}on(t,e){const i={event:t,callback:e};this._eventManager.subscribe(i)}off(t){this._eventManager.unsubscribe(t)}async createInstantRequest(t){this._key=await this._generateKey();const e=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(t)}]});this.handshakeId=e.id,this.handshakeTopic=tt(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",(()=>{throw new Error(mt)}));const i=()=>{this.killSession()};try{const t=await this._sendCallRequest(e);return t&&i(),t}catch(t){throw i(),t}}async connect(t){if(!this._qrcodeModal)throw new Error("QRCode Modal not provided");return this.connected?{chainId:this.chainId,accounts:this.accounts}:(await this.createSession(t),new Promise((async(t,e)=>{this.on("modal_closed",(()=>e(new Error(mt)))),this.on("connect",((i,r)=>{if(i)return e(i);t(r.params[0])}))})))}async createSession(t){if(this._connected)throw new Error(dt);if(this.pending)return;this._key=await this._generateKey();const e=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:t&&t.chainId?t.chainId:null}]});this.handshakeId=e.id,this.handshakeTopic=tt(),this._sendSessionRequest(e,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}approveSession(t){if(this._connected)throw new Error(dt);this.chainId=t.chainId,this.accounts=t.accounts,this.networkId=t.networkId||0,this.rpcUrl=t.rpcUrl||"";const e={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},i={id:this.handshakeId,jsonrpc:"2.0",result:e};this._sendResponse(i),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(t){if(this._connected)throw new Error(dt);const e=t&&t.message?t.message:"Session Rejected",i=this._formatResponse({id:this.handshakeId,error:{message:e}});this._sendResponse(i),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:e}]}),this._removeStorageSession()}updateSession(t){if(!this._connected)throw new Error(pt);this.chainId=t.chainId,this.accounts=t.accounts,this.networkId=t.networkId||0,this.rpcUrl=t.rpcUrl||"";const e={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},i=this._formatRequest({method:"wc_sessionUpdate",params:[e]});this._sendSessionRequest(i,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}async killSession(t){const e=t?t.message:"Session Disconnected",i=this._formatRequest({method:"wc_sessionUpdate",params:[{approved:!1,chainId:null,networkId:null,accounts:null}]});await this._sendRequest(i),this._handleSessionDisconnect(e)}async sendTransaction(t){if(!this._connected)throw new Error(pt);const e=ot(t),i=this._formatRequest({method:"eth_sendTransaction",params:[e]});return await this._sendCallRequest(i)}async signTransaction(t){if(!this._connected)throw new Error(pt);const e=ot(t),i=this._formatRequest({method:"eth_signTransaction",params:[e]});return await this._sendCallRequest(i)}async signMessage(t){if(!this._connected)throw new Error(pt);const e=this._formatRequest({method:"eth_sign",params:t});return await this._sendCallRequest(e)}async signPersonalMessage(t){if(!this._connected)throw new Error(pt);t=st(t);const e=this._formatRequest({method:"personal_sign",params:t});return await this._sendCallRequest(e)}async signTypedData(t){if(!this._connected)throw new Error(pt);const e=this._formatRequest({method:"eth_signTypedData",params:t});return await this._sendCallRequest(e)}async updateChain(t){if(!this._connected)throw new Error("Session currently disconnected");const e=this._formatRequest({method:"wallet_updateChain",params:[t]});return await this._sendCallRequest(e)}unsafeSend(t,e){return this._sendRequest(t,e),this._eventManager.trigger({event:"call_request_sent",params:[{request:t,options:e}]}),new Promise(((e,i)=>{this._subscribeToResponse(t.id,((t,r)=>{if(t)i(t);else{if(!r)throw new Error("Missing JSON RPC response");e(r)}}))}))}async sendCustomRequest(t,e){if(!this._connected)throw new Error(pt);switch(t.method){case"eth_accounts":return this.accounts;case"eth_chainId":return H(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":t.params&&(t.params[0]=ot(t.params[0]));break;case"personal_sign":t.params&&(t.params=st(t.params))}const i=this._formatRequest(t);return await this._sendCallRequest(i,e)}approveRequest(t){if(!it(t))throw new Error('JSON-RPC success response must include "result" field');{const e=this._formatResponse(t);this._sendResponse(e)}}rejectRequest(t){if(!rt(t))throw new Error('JSON-RPC error response must include "error" field');{const e=this._formatResponse(t);this._sendResponse(e)}}transportClose(){this._transport.close()}async _sendRequest(t,e){const i=this._formatRequest(t),r=await this._encrypt(i),n=void 0!==(null==e?void 0:e.topic)?e.topic:this.peerId,s=JSON.stringify(r),o=void 0!==(null==e?void 0:e.forcePushNotification)?!e.forcePushNotification:function(t){return!!t.method.startsWith("wc_")||!T.includes(t.method)}(i);this._transport.send(s,n,o)}async _sendResponse(t){const e=await this._encrypt(t),i=this.peerId,r=JSON.stringify(e);this._transport.send(r,i,!0)}async _sendSessionRequest(t,e,i){this._sendRequest(t,i),this._subscribeToSessionResponse(t.id,e)}_sendCallRequest(t,e){return this._sendRequest(t,e),this._eventManager.trigger({event:"call_request_sent",params:[{request:t,options:e}]}),this._subscribeToCallResponse(t.id)}_formatRequest(t){if(void 0===t.method)throw new Error('JSON RPC request must have valid "method" value');return{id:void 0===t.id?Y():t.id,jsonrpc:"2.0",method:t.method,params:void 0===t.params?[]:t.params}}_formatResponse(t){if(void 0===t.id)throw new Error('JSON RPC request must have valid "id" value');const e={id:t.id,jsonrpc:"2.0"};if(rt(t)){const i=function(t){const e=t.message||"Failed or Rejected Request";let i=-32e3;if(t&&!t.code)switch(e){case"Parse error":i=-32700;break;case"Invalid request":i=-32600;break;case"Method not found":i=-32601;break;case"Invalid params":i=-32602;break;case"Internal error":i=-32603;break;default:i=-32e3}const r={code:i,message:e};return t.data&&(r.data=t.data),r}(t.error);return Object.assign(Object.assign(Object.assign({},e),t),{error:i})}if(it(t))return Object.assign(Object.assign({},e),t);throw new Error(ft)}_handleSessionDisconnect(t){const e=t||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),I(O)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:e}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(t,e){e&&e.approved?(this._connected?(e.chainId&&(this.chainId=e.chainId),e.accounts&&(this.accounts=e.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,e.chainId&&(this.chainId=e.chainId),e.accounts&&(this.accounts=e.accounts),e.peerId&&!this.peerId&&(this.peerId=e.peerId),e.peerMeta&&!this.peerMeta&&(this.peerMeta=e.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(t)}async _handleIncomingMessages(t){if(![this.clientId,this.handshakeTopic].includes(t.topic))return;let e;try{e=JSON.parse(t.payload)}catch(t){return}const i=await this._decrypt(e);i&&this._eventManager.trigger(i)}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(t,e){this.on(`response:${t}`,e)}_subscribeToSessionResponse(t,e){this._subscribeToResponse(t,((t,i)=>{t?this._handleSessionResponse(t.message):it(i)?this._handleSessionResponse(e,i.result):i.error&&i.error.message?this._handleSessionResponse(i.error.message):this._handleSessionResponse(e)}))}_subscribeToCallResponse(t){return new Promise(((e,i)=>{this._subscribeToResponse(t,((t,r)=>{t?i(t):it(r)?e(r.result):r.error&&r.error.message?i(r.error):i(new Error(ft))}))}))}_subscribeToInternalEvents(){this.on("display_uri",(()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,(()=>{this._eventManager.trigger({event:"modal_closed",params:[]})}),this._qrcodeModalOptions)})),this.on("connect",(()=>{this._qrcodeModal&&this._qrcodeModal.close()})),this.on("call_request_sent",((t,e)=>{const{request:i}=e.params[0];if(M()&&(function(){const t=M();return!!t&&t.toLowerCase().includes("android")}()||function(){const t=M();return!!t&&(t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1)}())&&this._signingMethods.includes(i.method)){const t=S(O);t&&(window.location.href=t.href)}})),this.on("wc_sessionRequest",((t,e)=>{t&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:t.toString()}]}),this.handshakeId=e.id,this.peerId=e.params[0].peerId,this.peerMeta=e.params[0].peerMeta;const i=Object.assign(Object.assign({},e),{method:"session_request"});this._eventManager.trigger(i)})),this.on("wc_sessionUpdate",((t,e)=>{t&&this._handleSessionResponse(t.message),this._handleSessionResponse("Session disconnected",e.params[0])}))}_initTransport(){this._transport.on("message",(t=>this._handleIncomingMessages(t))),this._transport.on("open",(()=>this._eventManager.trigger({event:"transport_open",params:[]}))),this._transport.on("close",(()=>this._eventManager.trigger({event:"transport_close",params:[]}))),this._transport.on("error",(()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]}))),this._transport.open()}_formatUri(){return`${this.protocol}:${this.handshakeTopic}@${this.version}?bridge=${encodeURIComponent(this.bridge)}&key=${this.key}`}_parseUri(t){const e=function(t){const e=t.indexOf(":"),i=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e),n=function(t){const e=t.split("@");return{handshakeTopic:e[0],version:parseInt(e[1],10)}}(t.substring(e+1,i)),s=function(t){const e=at(t);return{key:e.key||"",bridge:e.bridge||""}}(void 0!==i?t.substr(i):"");return Object.assign(Object.assign({protocol:r},n),s)}(t);if(e.protocol===this.protocol){if(!e.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const t=e.handshakeTopic;if(!e.bridge)throw Error("Invalid or missing bridge url parameter value");const i=decodeURIComponent(e.bridge);if(!e.key)throw Error("Invalid or missing key parameter value");return{handshakeTopic:t,bridge:i,key:e.key}}throw new Error("URI format is invalid")}async _generateKey(){return this._cryptoLib?await this._cryptoLib.generateKey():null}async _encrypt(t){const e=this._key;return this._cryptoLib&&e?await this._cryptoLib.encrypt(t,e):null}async _decrypt(t){const e=this._key;return this._cryptoLib&&e?await this._cryptoLib.decrypt(t,e):null}_getStorageSession(){let t=null;return this._sessionStorage&&(t=this._sessionStorage.getSession()),t}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(t){if(!t.url||"string"!=typeof t.url)throw Error("Invalid or missing pushServerOpts.url parameter value");if(!t.type||"string"!=typeof t.type)throw Error("Invalid or missing pushServerOpts.type parameter value");if(!t.token||"string"!=typeof t.token)throw Error("Invalid or missing pushServerOpts.token parameter value");const e={bridge:this.bridge,topic:this.clientId,type:t.type,token:t.token,peerName:"",language:t.language||""};this.on("connect",(async(i,r)=>{if(i)throw i;if(t.peerMeta){const t=r.params[0].peerMeta.name;e.peerName=t}try{const i=await fetch(`${t.url}/new`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)});if(!(await i.json()).success)throw Error("Failed to register in Push Server")}catch(i){throw Error("Failed to register in Push Server")}}))}};var _t=i(1468);const bt=256,kt=256,St="AES-CBC",It=`SHA-${bt}`,Ot="HMAC",Rt="encrypt",Tt="decrypt",qt="sign",At="verify";async function Et(t,e=St){return _t.getSubtleCrypto().importKey("raw",t,function(t){return t===St?{length:bt,name:St}:{hash:{name:It},name:Ot}}(e),!0,function(t){return t===St?[Rt,Tt]:[qt,At]}(e))}async function xt(t,e){const i=await async function(t,e){const i=_t.getSubtleCrypto(),r=await Et(t,Ot),n=await i.sign({length:kt,name:Ot},r,e);return new Uint8Array(n)}(t,e);return i}async function Ct(t){const e=function(t){return _t.getBrowerCrypto().getRandomValues(new Uint8Array(t))}((t||256)/8);return B(U(e)).buffer}async function jt(t,e){const i=$(t.data),r=$(t.iv),n=P($(t.hmac),!1),s=Z(i,r),o=P(await xt(e,s),!1);return K(n)===K(o)}async function Nt(t,e,i){const r=B(V(e)),n=B(V(i||await Ct(128))),s=P(n,!1),o=B(D(JSON.stringify(t))),h=await function(t,e,i){return async function(t,e,i){const r=_t.getSubtleCrypto(),n=await Et(e,St),s=await r.encrypt({iv:t,name:St},n,i);return new Uint8Array(s)}(t,e,i)}(n,r,o),a=P(h,!1),u=Z(h,n);return{data:a,hmac:P(await xt(r,u),!1),iv:s}}async function Lt(t,e){const i=B(V(e));if(!i)throw new Error("Missing key: required for decryption");if(!await jt(t,i))return null;const r=$(t.data),n=$(t.iv),s=F(await function(t,e,i){return async function(t,e,i){const r=_t.getSubtleCrypto(),n=await Et(e,St),s=await r.decrypt({iv:t,name:St},n,i);return new Uint8Array(s)}(t,e,i)}(n,i,r));let o;try{o=JSON.parse(s)}catch(t){return null}return o}const Bt=class extends yt{constructor(t,e){super({cryptoLib:r,connectorOpts:t,pushServerOpts:e})}}},68007:t=>{"use strict";t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},11460:function(t,e,i){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t}function s(t,e,i){if(s.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(i=e,e=10),this._init(t||0,e||10,i||"be"))}var o;"object"==typeof t?t.exports=s:e.BN=s,s.BN=s,s.wordSize=26;try{o=i(36563).Buffer}catch(t){}function h(t,e,i){for(var r=0,n=Math.min(t.length,i),s=e;s=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return r}function a(t,e,i,r){for(var n=0,s=Math.min(t.length,i),o=e;o=49?h-49+10:h>=17?h-17+10:h}return n}s.isBN=function(t){return t instanceof s||null!==t&&"object"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),e,i)},s.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},s.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[s]|=o<>>26-h&67108863,(h+=24)>=26&&(h-=26,s++);else if("le"===i)for(n=0,s=0;n>>26-h&67108863,(h+=24)>=26&&(h-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=6)n=h(t,i,i+6),this.words[r]|=n<>>26-s&4194303,(s+=24)>=26&&(s-=26,r++);i+6!==e&&(n=h(t,e,i+6),this.words[r]|=n<>>26-s&4194303),this.strip()},s.prototype._parseBase=function(t,e,i){this.words=[0],this.length=1;for(var r=0,n=1;n<=67108863;n*=e)r++;r--,n=n/e|0;for(var s=t.length-i,o=s%r,h=Math.min(s,s-o)+i,u=0,c=i;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,i){i.negative=e.negative^t.negative;var r=t.length+e.length|0;i.length=r,r=r-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,h=67108863&o,a=o/67108864|0;i.words[0]=h;for(var u=1;u>>26,l=67108863&a,d=Math.min(u,e.length-1),p=Math.max(0,u-t.length+1);p<=d;p++){var f=u-p|0;c+=(o=(n=0|t.words[f])*(s=0|e.words[p])+l)/67108864|0,l=67108863&o}i.words[u]=0|l,a=0|c}return 0!==a?i.words[u]=0|a:i.length--,i.strip()}s.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,s=0,o=0;o>>24-n&16777215)||o!==this.length-1?u[6-a.length]+a+i:a+i,(n+=2)>=26&&(n-=26,o--)}for(0!==s&&(i=s.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var d=c[t],p=l[t];i="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(p).toString(t);i=(f=f.idivn(p)).isZero()?m+i:u[d-m.length]+m+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),s=i||Math.max(1,n);r(n<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0"),this.strip();var o,h,a="le"===e,u=new t(s),c=this.clone();if(a){for(h=0;!c.isZero();h++)o=c.andln(255),c.iushrn(8),u[h]=o;for(;h=4096&&(i+=13,e>>>=13),e>=64&&(i+=7,e>>>=7),e>=8&&(i+=4,e>>>=4),e>=2&&(i+=2,e>>>=2),i+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,i=0;return 0==(8191&e)&&(i+=13,e>>>=13),0==(127&e)&&(i+=7,e>>>=7),0==(15&e)&&(i+=4,e>>>=4),0==(3&e)&&(i+=2,e>>>=2),0==(1&e)&&i++,i},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var i=0;it.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,i;this.length>t.length?(e=this,i=t):(e=t,i=this);for(var r=0;rt.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<t.length?(i=this,r=t):(i=t,r=this);for(var n=0,s=0;s>>26;for(;0!==n&&s>>26;if(this.length=i.length,0!==n)this.words[this.length]=n,this.length++;else if(i!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},s.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 i,r,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(i=this,r=t):(i=t,r=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,p=0|o[1],f=8191&p,m=p>>>13,g=0|o[2],v=8191&g,w=g>>>13,M=0|o[3],y=8191&M,_=M>>>13,b=0|o[4],k=8191&b,S=b>>>13,I=0|o[5],O=8191&I,R=I>>>13,T=0|o[6],q=8191&T,A=T>>>13,E=0|o[7],x=8191&E,C=E>>>13,j=0|o[8],N=8191&j,L=j>>>13,B=0|o[9],W=8191&B,U=B>>>13,P=0|h[0],F=8191&P,$=P>>>13,D=0|h[1],Z=8191&D,J=D>>>13,K=0|h[2],z=8191&K,Q=K>>>13,V=0|h[3],H=8191&V,X=V>>>13,G=0|h[4],Y=8191&G,tt=G>>>13,et=0|h[5],it=8191&et,rt=et>>>13,nt=0|h[6],st=8191&nt,ot=nt>>>13,ht=0|h[7],at=8191&ht,ut=ht>>>13,ct=0|h[8],lt=8191&ct,dt=ct>>>13,pt=0|h[9],ft=8191&pt,mt=pt>>>13;i.negative=t.negative^e.negative,i.length=19;var gt=(u+(r=Math.imul(l,F))|0)+((8191&(n=(n=Math.imul(l,$))+Math.imul(d,F)|0))<<13)|0;u=((s=Math.imul(d,$))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(f,F),n=(n=Math.imul(f,$))+Math.imul(m,F)|0,s=Math.imul(m,$);var vt=(u+(r=r+Math.imul(l,Z)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(d,Z)|0))<<13)|0;u=((s=s+Math.imul(d,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(v,F),n=(n=Math.imul(v,$))+Math.imul(w,F)|0,s=Math.imul(w,$),r=r+Math.imul(f,Z)|0,n=(n=n+Math.imul(f,J)|0)+Math.imul(m,Z)|0,s=s+Math.imul(m,J)|0;var wt=(u+(r=r+Math.imul(l,z)|0)|0)+((8191&(n=(n=n+Math.imul(l,Q)|0)+Math.imul(d,z)|0))<<13)|0;u=((s=s+Math.imul(d,Q)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(y,F),n=(n=Math.imul(y,$))+Math.imul(_,F)|0,s=Math.imul(_,$),r=r+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(w,Z)|0,s=s+Math.imul(w,J)|0,r=r+Math.imul(f,z)|0,n=(n=n+Math.imul(f,Q)|0)+Math.imul(m,z)|0,s=s+Math.imul(m,Q)|0;var Mt=(u+(r=r+Math.imul(l,H)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(d,H)|0))<<13)|0;u=((s=s+Math.imul(d,X)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(k,F),n=(n=Math.imul(k,$))+Math.imul(S,F)|0,s=Math.imul(S,$),r=r+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(_,Z)|0,s=s+Math.imul(_,J)|0,r=r+Math.imul(v,z)|0,n=(n=n+Math.imul(v,Q)|0)+Math.imul(w,z)|0,s=s+Math.imul(w,Q)|0,r=r+Math.imul(f,H)|0,n=(n=n+Math.imul(f,X)|0)+Math.imul(m,H)|0,s=s+Math.imul(m,X)|0;var yt=(u+(r=r+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(d,Y)|0))<<13)|0;u=((s=s+Math.imul(d,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(O,F),n=(n=Math.imul(O,$))+Math.imul(R,F)|0,s=Math.imul(R,$),r=r+Math.imul(k,Z)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(S,Z)|0,s=s+Math.imul(S,J)|0,r=r+Math.imul(y,z)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(_,z)|0,s=s+Math.imul(_,Q)|0,r=r+Math.imul(v,H)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(w,H)|0,s=s+Math.imul(w,X)|0,r=r+Math.imul(f,Y)|0,n=(n=n+Math.imul(f,tt)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,tt)|0;var _t=(u+(r=r+Math.imul(l,it)|0)|0)+((8191&(n=(n=n+Math.imul(l,rt)|0)+Math.imul(d,it)|0))<<13)|0;u=((s=s+Math.imul(d,rt)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(q,F),n=(n=Math.imul(q,$))+Math.imul(A,F)|0,s=Math.imul(A,$),r=r+Math.imul(O,Z)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(R,Z)|0,s=s+Math.imul(R,J)|0,r=r+Math.imul(k,z)|0,n=(n=n+Math.imul(k,Q)|0)+Math.imul(S,z)|0,s=s+Math.imul(S,Q)|0,r=r+Math.imul(y,H)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(_,H)|0,s=s+Math.imul(_,X)|0,r=r+Math.imul(v,Y)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(w,Y)|0,s=s+Math.imul(w,tt)|0,r=r+Math.imul(f,it)|0,n=(n=n+Math.imul(f,rt)|0)+Math.imul(m,it)|0,s=s+Math.imul(m,rt)|0;var bt=(u+(r=r+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(d,st)|0))<<13)|0;u=((s=s+Math.imul(d,ot)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,F),n=(n=Math.imul(x,$))+Math.imul(C,F)|0,s=Math.imul(C,$),r=r+Math.imul(q,Z)|0,n=(n=n+Math.imul(q,J)|0)+Math.imul(A,Z)|0,s=s+Math.imul(A,J)|0,r=r+Math.imul(O,z)|0,n=(n=n+Math.imul(O,Q)|0)+Math.imul(R,z)|0,s=s+Math.imul(R,Q)|0,r=r+Math.imul(k,H)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(S,H)|0,s=s+Math.imul(S,X)|0,r=r+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,tt)|0,r=r+Math.imul(v,it)|0,n=(n=n+Math.imul(v,rt)|0)+Math.imul(w,it)|0,s=s+Math.imul(w,rt)|0,r=r+Math.imul(f,st)|0,n=(n=n+Math.imul(f,ot)|0)+Math.imul(m,st)|0,s=s+Math.imul(m,ot)|0;var kt=(u+(r=r+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(d,at)|0))<<13)|0;u=((s=s+Math.imul(d,ut)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(N,F),n=(n=Math.imul(N,$))+Math.imul(L,F)|0,s=Math.imul(L,$),r=r+Math.imul(x,Z)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(C,Z)|0,s=s+Math.imul(C,J)|0,r=r+Math.imul(q,z)|0,n=(n=n+Math.imul(q,Q)|0)+Math.imul(A,z)|0,s=s+Math.imul(A,Q)|0,r=r+Math.imul(O,H)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(R,H)|0,s=s+Math.imul(R,X)|0,r=r+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(S,Y)|0,s=s+Math.imul(S,tt)|0,r=r+Math.imul(y,it)|0,n=(n=n+Math.imul(y,rt)|0)+Math.imul(_,it)|0,s=s+Math.imul(_,rt)|0,r=r+Math.imul(v,st)|0,n=(n=n+Math.imul(v,ot)|0)+Math.imul(w,st)|0,s=s+Math.imul(w,ot)|0,r=r+Math.imul(f,at)|0,n=(n=n+Math.imul(f,ut)|0)+Math.imul(m,at)|0,s=s+Math.imul(m,ut)|0;var St=(u+(r=r+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(d,lt)|0))<<13)|0;u=((s=s+Math.imul(d,dt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(W,F),n=(n=Math.imul(W,$))+Math.imul(U,F)|0,s=Math.imul(U,$),r=r+Math.imul(N,Z)|0,n=(n=n+Math.imul(N,J)|0)+Math.imul(L,Z)|0,s=s+Math.imul(L,J)|0,r=r+Math.imul(x,z)|0,n=(n=n+Math.imul(x,Q)|0)+Math.imul(C,z)|0,s=s+Math.imul(C,Q)|0,r=r+Math.imul(q,H)|0,n=(n=n+Math.imul(q,X)|0)+Math.imul(A,H)|0,s=s+Math.imul(A,X)|0,r=r+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(R,Y)|0,s=s+Math.imul(R,tt)|0,r=r+Math.imul(k,it)|0,n=(n=n+Math.imul(k,rt)|0)+Math.imul(S,it)|0,s=s+Math.imul(S,rt)|0,r=r+Math.imul(y,st)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,r=r+Math.imul(v,at)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(w,at)|0,s=s+Math.imul(w,ut)|0,r=r+Math.imul(f,lt)|0,n=(n=n+Math.imul(f,dt)|0)+Math.imul(m,lt)|0,s=s+Math.imul(m,dt)|0;var It=(u+(r=r+Math.imul(l,ft)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(d,ft)|0))<<13)|0;u=((s=s+Math.imul(d,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(W,Z),n=(n=Math.imul(W,J))+Math.imul(U,Z)|0,s=Math.imul(U,J),r=r+Math.imul(N,z)|0,n=(n=n+Math.imul(N,Q)|0)+Math.imul(L,z)|0,s=s+Math.imul(L,Q)|0,r=r+Math.imul(x,H)|0,n=(n=n+Math.imul(x,X)|0)+Math.imul(C,H)|0,s=s+Math.imul(C,X)|0,r=r+Math.imul(q,Y)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,tt)|0,r=r+Math.imul(O,it)|0,n=(n=n+Math.imul(O,rt)|0)+Math.imul(R,it)|0,s=s+Math.imul(R,rt)|0,r=r+Math.imul(k,st)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(S,st)|0,s=s+Math.imul(S,ot)|0,r=r+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(_,at)|0,s=s+Math.imul(_,ut)|0,r=r+Math.imul(v,lt)|0,n=(n=n+Math.imul(v,dt)|0)+Math.imul(w,lt)|0,s=s+Math.imul(w,dt)|0;var Ot=(u+(r=r+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,mt)|0)+Math.imul(m,ft)|0))<<13)|0;u=((s=s+Math.imul(m,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(W,z),n=(n=Math.imul(W,Q))+Math.imul(U,z)|0,s=Math.imul(U,Q),r=r+Math.imul(N,H)|0,n=(n=n+Math.imul(N,X)|0)+Math.imul(L,H)|0,s=s+Math.imul(L,X)|0,r=r+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,Y)|0,s=s+Math.imul(C,tt)|0,r=r+Math.imul(q,it)|0,n=(n=n+Math.imul(q,rt)|0)+Math.imul(A,it)|0,s=s+Math.imul(A,rt)|0,r=r+Math.imul(O,st)|0,n=(n=n+Math.imul(O,ot)|0)+Math.imul(R,st)|0,s=s+Math.imul(R,ot)|0,r=r+Math.imul(k,at)|0,n=(n=n+Math.imul(k,ut)|0)+Math.imul(S,at)|0,s=s+Math.imul(S,ut)|0,r=r+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,dt)|0)+Math.imul(_,lt)|0,s=s+Math.imul(_,dt)|0;var Rt=(u+(r=r+Math.imul(v,ft)|0)|0)+((8191&(n=(n=n+Math.imul(v,mt)|0)+Math.imul(w,ft)|0))<<13)|0;u=((s=s+Math.imul(w,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,r=Math.imul(W,H),n=(n=Math.imul(W,X))+Math.imul(U,H)|0,s=Math.imul(U,X),r=r+Math.imul(N,Y)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(L,Y)|0,s=s+Math.imul(L,tt)|0,r=r+Math.imul(x,it)|0,n=(n=n+Math.imul(x,rt)|0)+Math.imul(C,it)|0,s=s+Math.imul(C,rt)|0,r=r+Math.imul(q,st)|0,n=(n=n+Math.imul(q,ot)|0)+Math.imul(A,st)|0,s=s+Math.imul(A,ot)|0,r=r+Math.imul(O,at)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(R,at)|0,s=s+Math.imul(R,ut)|0,r=r+Math.imul(k,lt)|0,n=(n=n+Math.imul(k,dt)|0)+Math.imul(S,lt)|0,s=s+Math.imul(S,dt)|0;var Tt=(u+(r=r+Math.imul(y,ft)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(_,ft)|0))<<13)|0;u=((s=s+Math.imul(_,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(W,Y),n=(n=Math.imul(W,tt))+Math.imul(U,Y)|0,s=Math.imul(U,tt),r=r+Math.imul(N,it)|0,n=(n=n+Math.imul(N,rt)|0)+Math.imul(L,it)|0,s=s+Math.imul(L,rt)|0,r=r+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(C,st)|0,s=s+Math.imul(C,ot)|0,r=r+Math.imul(q,at)|0,n=(n=n+Math.imul(q,ut)|0)+Math.imul(A,at)|0,s=s+Math.imul(A,ut)|0,r=r+Math.imul(O,lt)|0,n=(n=n+Math.imul(O,dt)|0)+Math.imul(R,lt)|0,s=s+Math.imul(R,dt)|0;var qt=(u+(r=r+Math.imul(k,ft)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(S,ft)|0))<<13)|0;u=((s=s+Math.imul(S,mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,r=Math.imul(W,it),n=(n=Math.imul(W,rt))+Math.imul(U,it)|0,s=Math.imul(U,rt),r=r+Math.imul(N,st)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(L,st)|0,s=s+Math.imul(L,ot)|0,r=r+Math.imul(x,at)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(C,at)|0,s=s+Math.imul(C,ut)|0,r=r+Math.imul(q,lt)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(A,lt)|0,s=s+Math.imul(A,dt)|0;var At=(u+(r=r+Math.imul(O,ft)|0)|0)+((8191&(n=(n=n+Math.imul(O,mt)|0)+Math.imul(R,ft)|0))<<13)|0;u=((s=s+Math.imul(R,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(W,st),n=(n=Math.imul(W,ot))+Math.imul(U,st)|0,s=Math.imul(U,ot),r=r+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(L,at)|0,s=s+Math.imul(L,ut)|0,r=r+Math.imul(x,lt)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,lt)|0,s=s+Math.imul(C,dt)|0;var Et=(u+(r=r+Math.imul(q,ft)|0)|0)+((8191&(n=(n=n+Math.imul(q,mt)|0)+Math.imul(A,ft)|0))<<13)|0;u=((s=s+Math.imul(A,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(W,at),n=(n=Math.imul(W,ut))+Math.imul(U,at)|0,s=Math.imul(U,ut),r=r+Math.imul(N,lt)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(L,lt)|0,s=s+Math.imul(L,dt)|0;var xt=(u+(r=r+Math.imul(x,ft)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,ft)|0))<<13)|0;u=((s=s+Math.imul(C,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(W,lt),n=(n=Math.imul(W,dt))+Math.imul(U,lt)|0,s=Math.imul(U,dt);var Ct=(u+(r=r+Math.imul(N,ft)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(L,ft)|0))<<13)|0;u=((s=s+Math.imul(L,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863;var jt=(u+(r=Math.imul(W,ft))|0)+((8191&(n=(n=Math.imul(W,mt))+Math.imul(U,ft)|0))<<13)|0;return u=((s=Math.imul(U,mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a[0]=gt,a[1]=vt,a[2]=wt,a[3]=Mt,a[4]=yt,a[5]=_t,a[6]=bt,a[7]=kt,a[8]=St,a[9]=It,a[10]=Ot,a[11]=Rt,a[12]=Tt,a[13]=qt,a[14]=At,a[15]=Et,a[16]=xt,a[17]=Ct,a[18]=jt,0!==u&&(a[19]=u,i.length++),i};function f(t,e,i){return(new m).mulp(t,e,i)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),s.prototype.mulTo=function(t,e){var i,r=this.length+t.length;return i=10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,i){i.negative=e.negative^t.negative,i.length=t.length+e.length;for(var r=0,n=0,s=0;s>>26)|0)>>>26,o&=67108863}i.words[s]=h,r=o,o=n}return 0!==r?i.words[s]=r:i.length--,i.strip()}(this,t,e):f(this,t,e),i},m.prototype.makeRBT=function(t){for(var e=new Array(t),i=s.prototype._countBits(t)-1,r=0;r>=1;return r},m.prototype.permute=function(t,e,i,r,n,s){for(var o=0;o>>=1)n++;return 1<>>=13,i[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=s>>>26,this.words[i]=67108863&s}return 0!==e&&(this.words[i]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),i=0;i>>n}return e}(t);if(0===e.length)return new s(1);for(var i=this,r=0;r=0);var e,i=t%26,n=(t-i)/26,s=67108863>>>26-i<<26-i;if(0!==i){var o=0;for(e=0;e>>26-i}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),h=67108863^67108863>>>s<o)for(this.length-=o,u=0;u=0&&(0!==c||u>=n);u--){var l=0|this.words[u];this.words[u]=c<<26-s|l>>>s,c=l&h}return a&&0!==c&&(a.words[a.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<=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},s.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(a/67108864|0),this.words[n+i]=67108863&s}for(;n>26,this.words[n+i]=67108863&s;if(0===h)return this.strip();for(r(-1===h),h=0,n=0;n>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var i=(this.length,t.length),r=this.clone(),n=t,o=0|n.words[n.length-1];0!=(i=26-this._countBits(o))&&(n=n.ushln(i),r.iushln(i),o=0|n.words[n.length-1]);var h,a=r.length-n.length;if("mod"!==e){(h=new s(null)).length=a+1,h.words=new Array(h.length);for(var u=0;u=0;l--){var d=67108864*(0|r.words[n.length+l])+(0|r.words[n.length+l-1]);for(d=Math.min(d/o|0,67108863),r._ishlnsubmul(n,d,l);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(n,1,l),r.isZero()||(r.negative^=1);h&&(h.words[l]=d)}return h&&h.strip(),r.strip(),"div"!==e&&0!==i&&r.iushrn(i),{div:h||null,mod:r}},s.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,e),"mod"!==e&&(n=h.div.neg()),"div"!==e&&(o=h.mod.neg(),i&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),e),"mod"!==e&&(n=h.div.neg()),{div:n,mod:h.mod}):0!=(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),e),"div"!==e&&(o=h.mod.neg(),i&&0!==o.negative&&o.isub(t)),{div:h.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,h},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var i=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),n=t.andln(1),s=i.cmp(r);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},s.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),h=new s(0),a=new s(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var c=i.clone(),l=e.clone();!e.isZero();){for(var d=0,p=1;0==(e.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(c),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var f=0,m=1;0==(i.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(h.isOdd()||a.isOdd())&&(h.iadd(c),a.isub(l)),h.iushrn(1),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),n.isub(h),o.isub(a)):(i.isub(e),h.isub(n),a.isub(o))}return{a:h,b:a,gcd:i.iushln(u)}},s.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),h=new s(0),a=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,c=1;0==(e.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(a),o.iushrn(1);for(var l=0,d=1;0==(i.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(i.iushrn(l);l-- >0;)h.isOdd()&&h.iadd(a),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(h)):(i.isub(e),h.isub(o))}return(n=0===e.cmpn(1)?o:h).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),i=t.clone();e.negative=0,i.negative=0;for(var r=0;e.isEven()&&i.isEven();r++)e.iushrn(1),i.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;i.isEven();)i.iushrn(1);var n=e.cmp(i);if(n<0){var s=e;e=i,i=s}else if(0===n||0===i.cmpn(1))break;e.isub(i)}return i.iushln(r)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<>>26,h&=67108863,this.words[o]=h}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;i--){var r=0|this.words[i],n=0|t.words[i];if(r!==n){rn&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new b(t)},s.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function b(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){b.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,i=t;do{this.split(i,this.tmp),e=(i=(i=this.imulK(i)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e0?i.isub(this.p):i.strip(),i},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(w,v),w.prototype.split=function(t,e){for(var i=4194303,r=Math.min(t.length,9),n=0;n>>22,s=o}s>>>=22,t.words[n-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,i=0;i>>=26,t.words[i]=n,e=r}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new M;else if("p192"===t)e=new y;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return g[t]=e,e},b.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},b.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},b.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},b.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},b.prototype.add=function(t,e){this._verify2(t,e);var i=t.add(e);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},b.prototype.iadd=function(t,e){this._verify2(t,e);var i=t.iadd(e);return i.cmp(this.m)>=0&&i.isub(this.m),i},b.prototype.sub=function(t,e){this._verify2(t,e);var i=t.sub(e);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},b.prototype.isub=function(t,e){this._verify2(t,e);var i=t.isub(e);return i.cmpn(0)<0&&i.iadd(this.m),i},b.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},b.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},b.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},b.prototype.isqr=function(t){return this.imul(t,t.clone())},b.prototype.sqr=function(t){return this.mul(t,t)},b.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new s(1)).iushrn(2);return this.pow(t,i)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);r(!n.isZero());var h=new s(1).toRed(this),a=h.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);0!==this.pow(c,u).cmp(a);)c.redIAdd(a);for(var l=this.pow(c,n),d=this.pow(t,n.addn(1).iushrn(1)),p=this.pow(t,n),f=o;0!==p.cmp(h);){for(var m=p,g=0;0!==m.cmp(h);g++)m=m.redSqr();r(g=0;r--){for(var u=e.words[r],c=a-1;c>=0;c--){var l=u>>c&1;n!==i[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4==++h||0===r&&0===c)&&(n=this.mul(n,i[o]),h=0,o=0)):h=0}a=26}return n},b.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},b.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},n(k,b),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var i=t.imul(e),r=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(r).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var i=t.mul(e),r=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(r).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=i.nmd(t),this)},62873:(t,e)=>{"use strict";function i(t){let e;return"undefined"!=typeof window&&void 0!==window[t]&&(e=window[t]),e}function r(t){const e=i(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Object.defineProperty(e,"__esModule",{value:!0}),e.getLocalStorage=e.getLocalStorageOrThrow=e.getCrypto=e.getCryptoOrThrow=e.getLocation=e.getLocationOrThrow=e.getNavigator=e.getNavigatorOrThrow=e.getDocument=e.getDocumentOrThrow=e.getFromWindowOrThrow=e.getFromWindow=void 0,e.getFromWindow=i,e.getFromWindowOrThrow=r,e.getDocumentOrThrow=function(){return r("document")},e.getDocument=function(){return i("document")},e.getNavigatorOrThrow=function(){return r("navigator")},e.getNavigator=function(){return i("navigator")},e.getLocationOrThrow=function(){return r("location")},e.getLocation=function(){return i("location")},e.getCryptoOrThrow=function(){return r("crypto")},e.getCrypto=function(){return i("crypto")},e.getLocalStorageOrThrow=function(){return r("localStorage")},e.getLocalStorage=function(){return i("localStorage")}},65755:(t,e,i)=>{"use strict";e.D=void 0;const r=i(62873);e.D=function(){let t,e;try{t=r.getDocumentOrThrow(),e=r.getLocationOrThrow()}catch(t){return null}function i(...e){const i=t.getElementsByTagName("meta");for(let t=0;tr.getAttribute(t))).filter((t=>!!t&&e.includes(t)));if(n.length&&n){const t=r.getAttribute("content");if(t)return t}}return""}const n=function(){let e=i("name","og:site_name","og:title","twitter:title");return e||(e=t.title),e}();return{description:i("description","og:description","twitter:description","keywords"),url:e.origin,icons:function(){const i=t.getElementsByTagName("link"),r=[];for(let t=0;t-1){const t=n.getAttribute("href");if(t)if(-1===t.toLowerCase().indexOf("https:")&&-1===t.toLowerCase().indexOf("http:")&&0!==t.indexOf("//")){let i=e.protocol+"//"+e.host;if(0===t.indexOf("/"))i+=t;else{const r=e.pathname.split("/");r.pop(),i+=r.join("/")+"/"+t}r.push(i)}else if(0===t.indexOf("//")){const i=e.protocol+t;r.push(i)}else r.push(t)}}return r}(),name:n}}},4501:t=>{t.exports=r,r.strict=n,r.loose=s;var e=Object.prototype.toString,i={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function r(t){return n(t)||s(t)}function n(t){return t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array}function s(t){return i[e.call(t)]}},17563:(t,e,i)=>{"use strict";const r=i(70610),n=i(44020),s=i(80500);function o(t){if("string"!=typeof t||1!==t.length)throw new TypeError("arrayFormatSeparator must be single character string")}function h(t,e){return e.encode?e.strict?r(t):encodeURIComponent(t):t}function a(t,e){return e.decode?n(t):t}function u(t){return Array.isArray(t)?t.sort():"object"==typeof t?u(Object.keys(t)).sort(((t,e)=>Number(t)-Number(e))).map((e=>t[e])):t}function c(t){const e=t.indexOf("#");return-1!==e&&(t=t.slice(0,e)),t}function l(t){const e=(t=c(t)).indexOf("?");return-1===e?"":t.slice(e+1)}function d(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&"string"==typeof t&&""!==t.trim()?t=Number(t):!e.parseBooleans||null===t||"true"!==t.toLowerCase()&&"false"!==t.toLowerCase()||(t="true"===t.toLowerCase()),t}function p(t,e){o((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);const i=function(t){let e;switch(t.arrayFormat){case"index":return(t,i,r)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===r[t]&&(r[t]={}),r[t][e[1]]=i):r[t]=i};case"bracket":return(t,i,r)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==r[t]?r[t]=[].concat(r[t],i):r[t]=[i]:r[t]=i};case"comma":case"separator":return(e,i,r)=>{const n="string"==typeof i&&i.split("").indexOf(t.arrayFormatSeparator)>-1?i.split(t.arrayFormatSeparator).map((e=>a(e,t))):null===i?i:a(i,t);r[e]=n};default:return(t,e,i)=>{void 0!==i[t]?i[t]=[].concat(i[t],e):i[t]=e}}}(e),r=Object.create(null);if("string"!=typeof t)return r;if(!(t=t.trim().replace(/^[?#&]/,"")))return r;for(const n of t.split("&")){let[t,o]=s(e.decode?n.replace(/\+/g," "):n,"=");o=void 0===o?null:["comma","separator"].includes(e.arrayFormat)?o:a(o,e),i(a(t,e),o,r)}for(const t of Object.keys(r)){const i=r[t];if("object"==typeof i&&null!==i)for(const t of Object.keys(i))i[t]=d(i[t],e);else r[t]=d(i,e)}return!1===e.sort?r:(!0===e.sort?Object.keys(r).sort():Object.keys(r).sort(e.sort)).reduce(((t,e)=>{const i=r[e];return Boolean(i)&&"object"==typeof i&&!Array.isArray(i)?t[e]=u(i):t[e]=i,t}),Object.create(null))}e.extract=l,e.parse=p,e.stringify=(t,e)=>{if(!t)return"";o((e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e)).arrayFormatSeparator);const i=i=>e.skipNull&&null==t[i]||e.skipEmptyString&&""===t[i],r=function(t){switch(t.arrayFormat){case"index":return e=>(i,r)=>{const n=i.length;return void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?i:null===r?[...i,[h(e,t),"[",n,"]"].join("")]:[...i,[h(e,t),"[",h(n,t),"]=",h(r,t)].join("")]};case"bracket":return e=>(i,r)=>void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?i:null===r?[...i,[h(e,t),"[]"].join("")]:[...i,[h(e,t),"[]=",h(r,t)].join("")];case"comma":case"separator":return e=>(i,r)=>null==r||0===r.length?i:0===i.length?[[h(e,t),"=",h(r,t)].join("")]:[[i,h(r,t)].join(t.arrayFormatSeparator)];default:return e=>(i,r)=>void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?i:null===r?[...i,h(e,t)]:[...i,[h(e,t),"=",h(r,t)].join("")]}}(e),n={};for(const e of Object.keys(t))i(e)||(n[e]=t[e]);const s=Object.keys(n);return!1!==e.sort&&s.sort(e.sort),s.map((i=>{const n=t[i];return void 0===n?"":null===n?h(i,e):Array.isArray(n)?n.reduce(r(i),[]).join("&"):h(i,e)+"="+h(n,e)})).filter((t=>t.length>0)).join("&")},e.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);const[i,r]=s(t,"#");return Object.assign({url:i.split("?")[0]||"",query:p(l(t),e)},e&&e.parseFragmentIdentifier&&r?{fragmentIdentifier:a(r,e)}:{})},e.stringifyUrl=(t,i)=>{i=Object.assign({encode:!0,strict:!0},i);const r=c(t.url).split("?")[0]||"",n=e.extract(t.url),s=e.parse(n,{sort:!1}),o=Object.assign(s,t.query);let a=e.stringify(o,i);a&&(a=`?${a}`);let u=function(t){let e="";const i=t.indexOf("#");return-1!==i&&(e=t.slice(i)),e}(t.url);return t.fragmentIdentifier&&(u=`#${h(t.fragmentIdentifier,i)}`),`${r}${a}${u}`}},65054:(t,e,i)=>{var r=i(48764).Buffer,n=i(4501).strict;t.exports=function(t){if(n(t)){var e=r.from(t.buffer);return t.byteLength!==t.buffer.byteLength&&(e=e.slice(t.byteOffset,t.byteOffset+t.byteLength)),e}return r.from(t)}}}]); \ No newline at end of file diff --git a/gateway/dist/3785.bc7a16847791b7c31dfe.bundle.js b/gateway/dist/2711.34691f88d26d3e342523.bundle.js similarity index 89% rename from gateway/dist/3785.bc7a16847791b7c31dfe.bundle.js rename to gateway/dist/2711.34691f88d26d3e342523.bundle.js index d28cd883..3ac9cf76 100644 --- a/gateway/dist/3785.bc7a16847791b7c31dfe.bundle.js +++ b/gateway/dist/2711.34691f88d26d3e342523.bundle.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[3785],{53785:(e,t,H)=>{H.r(t),H.d(t,{default:()=>V});const V='\n\n\n\n'}}]); \ No newline at end of file +"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[2711],{82711:(e,t,H)=>{H.r(t),H.d(t,{default:()=>V});const V='\n\n\n\n'}}]); \ No newline at end of file diff --git a/gateway/dist/2720.7b0337e34ef532f1f418.bundle.js b/gateway/dist/2720.7b0337e34ef532f1f418.bundle.js new file mode 100644 index 00000000..13376dd1 --- /dev/null +++ b/gateway/dist/2720.7b0337e34ef532f1f418.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[2720],{52720:(t,n,e)=>{e.r(n),e.d(n,{default:()=>Q});var o=e(40136),i=e(88812),r=e(29050),a=e(12115),s=e(38828);function l(t,{from:n,to:e},i={}){const r=getComputedStyle(t),a="none"===r.transform?"":r.transform,[s,l]=r.transformOrigin.split(" ").map(parseFloat),c=n.left+n.width*s/e.width-(e.left+s),d=n.top+n.height*l/e.height-(e.top+l),{delay:f=0,duration:p=(t=>120*Math.sqrt(t)),easing:v=o.an}=i;return{delay:f,duration:(0,o.Z)(p)?p(Math.sqrt(c*c+d*d)):p,easing:v,css:(t,o)=>{const i=o*c,r=o*d,s=t+o*n.width/e.width,l=t+o*n.height/e.height;return`transform: ${a} translate(${i}px, ${r}px) scale(${s}, ${l});`}}}function c(t){(0,o.a)(t,"svelte-13cuwwo","div.svelte-13cuwwo{box-sizing:content-box}.border.svelte-13cuwwo{border:2px solid;border-radius:120px;overflow:hidden}")}function d(t){let n,e;return{c(){n=(0,o.j)("div"),(0,o.k)(n,"class","border svelte-13cuwwo"),(0,o.k)(n,"style",e=`\n width: ${t[2]-2*t[3]}px; \n height: ${t[2]-2*t[3]}px; \n border-color: var(${t[1]}); \n padding: ${t[3]}px; \n background-color: ${t[4]};\n border-radius: 50%;\n display: flex;\n justify-content: center;\n `)},m(e,i){(0,o.b)(e,n,i),n.innerHTML=t[0]},p(t,[i]){1&i&&(n.innerHTML=t[0]),30&i&&e!==(e=`\n width: ${t[2]-2*t[3]}px; \n height: ${t[2]-2*t[3]}px; \n border-color: var(${t[1]}); \n padding: ${t[3]}px; \n background-color: ${t[4]};\n border-radius: 50%;\n display: flex;\n justify-content: center;\n `)&&(0,o.k)(n,"style",e)},i:o.n,o:o.n,d(t){t&&(0,o.d)(n)}}}function f(t,n,e){let{icon:o}=n,{borderColorVar:i}=n,{size:r}=n,{padding:a=0}=n,{background:s="transparent"}=n;return t.$$set=t=>{"icon"in t&&e(0,o=t.icon),"borderColorVar"in t&&e(1,i=t.borderColorVar),"size"in t&&e(2,r=t.size),"padding"in t&&e(3,a=t.padding),"background"in t&&e(4,s=t.background)},[o,i,r,a,s]}e(46880),e(16075),e(54213),e(60346),e(12926),e(63064),e(70182),e(30228);class p extends o.S{constructor(t){super(),(0,o.i)(this,t,f,d,o.s,{icon:0,borderColorVar:1,size:2,padding:3,background:4},c)}}function v(t){(0,o.a)(t,"svelte-jvic9v","div.notification-icons-wrapper.svelte-jvic9v{height:32px;width:32px}.border.svelte-jvic9v{border-radius:8px}div.notification-icon.svelte-jvic9v{padding:6px}div.pending-icon.svelte-jvic9v{animation:svelte-jvic9v-blink 2s ease-in infinite;height:100%;width:100%;padding:7px}@keyframes svelte-jvic9v-blink{from,to{opacity:1}50%{opacity:0.2}}div.border-action.svelte-jvic9v{height:32px;min-width:32px;border-radius:8px;overflow:hidden;will-change:transform}div.border-action.svelte-jvic9v:before{content:'';background-image:conic-gradient(#b1b7f2 20deg, #6370e5 120deg);height:140%;width:140%;position:absolute;left:-25%;top:-25%;animation:svelte-jvic9v-rotate 2s infinite linear}div.chain-icon-container.svelte-jvic9v{left:18px;top:18px}@keyframes svelte-jvic9v-rotate{100%{transform:rotate(-360deg)}}")}function u(t){let n,e,i,r,a,s,l,c,d=o.ao[t[1].type].eventIcon+"",f=!t[1].id.includes("customNotification")&&!t[1].id.includes("preflight"),p="pending"===t[1].type&&y(),v=f&&m(t);return{c(){n=(0,o.j)("div"),p&&p.c(),e=(0,o.G)(),i=(0,o.j)("div"),r=(0,o.j)("div"),l=(0,o.G)(),v&&v.c(),(0,o.k)(r,"class",a=(0,o.l)("notification-icon flex items-center justify-center "+("pending"===t[1].type?"pending-icon":""))+" svelte-jvic9v"),(0,o.k)(i,"class","flex items-center justify-center border relative notification-icons-wrapper svelte-jvic9v"),(0,o.k)(i,"style",s=`background:${o.ao[t[1].type].backgroundColor}; color: ${o.ao[t[1].type].iconColor||""}; ${"pending"===t[1].type?"height: 28px; width: 28px; margin: 2px;":`border: 2px solid ${o.ao[t[1].type].borderColor}`}; `),(0,o.k)(n,"class","relative")},m(t,a){(0,o.b)(t,n,a),p&&p.m(n,null),(0,o.m)(n,e),(0,o.m)(n,i),(0,o.m)(i,r),r.innerHTML=d,(0,o.m)(n,l),v&&v.m(n,null),c=!0},p(t,l){"pending"===t[1].type?p||(p=y(),p.c(),p.m(n,e)):p&&(p.d(1),p=null),(!c||2&l)&&d!==(d=o.ao[t[1].type].eventIcon+"")&&(r.innerHTML=d),(!c||2&l&&a!==(a=(0,o.l)("notification-icon flex items-center justify-center "+("pending"===t[1].type?"pending-icon":""))+" svelte-jvic9v"))&&(0,o.k)(r,"class",a),(!c||2&l&&s!==(s=`background:${o.ao[t[1].type].backgroundColor}; color: ${o.ao[t[1].type].iconColor||""}; ${"pending"===t[1].type?"height: 28px; width: 28px; margin: 2px;":`border: 2px solid ${o.ao[t[1].type].borderColor}`}; `))&&(0,o.k)(i,"style",s),2&l&&(f=!t[1].id.includes("customNotification")&&!t[1].id.includes("preflight")),f?v?(v.p(t,l),2&l&&(0,o.x)(v,1)):(v=m(t),v.c(),(0,o.x)(v,1),v.m(n,null)):v&&((0,o.y)(),(0,o.A)(v,1,1,(()=>{v=null})),(0,o.z)())},i(t){c||((0,o.x)(v),c=!0)},o(t){(0,o.A)(v),c=!1},d(t){t&&(0,o.d)(n),p&&p.d(),v&&v.d()}}}function y(t){let n;return{c(){n=(0,o.j)("div"),(0,o.k)(n,"class","border-action absolute svelte-jvic9v")},m(t,e){(0,o.b)(t,n,e)},d(t){t&&(0,o.d)(n)}}}function m(t){let n,e,i;return e=new p({props:{icon:t[0].icon,size:16,background:t[0].color,borderColorVar:"--notify-onboard-background, var(--onboard-gray-600, var(--gray-600))",padding:3}}),{c(){n=(0,o.j)("div"),(0,o.F)(e.$$.fragment),(0,o.k)(n,"class","absolute chain-icon-container svelte-jvic9v")},m(t,r){(0,o.b)(t,n,r),(0,o.I)(e,n,null),i=!0},p(t,n){const o={};1&n&&(o.icon=t[0].icon),1&n&&(o.background=t[0].color),e.$set(o)},i(t){i||((0,o.x)(e.$$.fragment,t),i=!0)},o(t){(0,o.A)(e.$$.fragment,t),i=!1},d(t){t&&(0,o.d)(n),(0,o.K)(e)}}}function b(t){let n,e,i=t[1].type&&u(t);return{c(){i&&i.c(),n=(0,o.e)()},m(t,r){i&&i.m(t,r),(0,o.b)(t,n,r),e=!0},p(t,[e]){t[1].type?i?(i.p(t,e),2&e&&(0,o.x)(i,1)):(i=u(t),i.c(),(0,o.x)(i,1),i.m(n.parentNode,n)):i&&((0,o.y)(),(0,o.A)(i,1,1,(()=>{i=null})),(0,o.z)())},i(t){e||((0,o.x)(i),e=!0)},o(t){(0,o.A)(i),e=!1},d(t){i&&i.d(t),t&&(0,o.d)(n)}}}function h(t,n,e){let{chainStyles:i=o.a6}=n,{notification:r}=n;return t.$$set=t=>{"chainStyles"in t&&e(0,i=t.chainStyles),"notification"in t&&e(1,r=t.notification)},[i,r]}class g extends o.S{constructor(t){super(),(0,o.i)(this,t,h,b,o.s,{chainStyles:0,notification:1},v)}}function k(t){(0,o.a)(t,"svelte-pm7idu","div.svelte-pm7idu{display:flex;justify-content:center;font-size:inherit;font-family:inherit;margin:0 1.5rem 0 0.75rem}span.svelte-pm7idu{font-family:inherit;display:flex;align-items:center;margin:0 2px}.time.svelte-pm7idu{color:var(\n --notify-onboard-timer-color,\n var(--onboard-gray-300, var(--gray-300))\n );margin-left:4px}")}function x(t){let n,e,i,r,a=t[2](t[1]-t[0])+"";return{c(){n=(0,o.t)("-\n "),e=(0,o.j)("span"),i=(0,o.t)(a),r=(0,o.t)("\n ago"),(0,o.k)(e,"class","svelte-pm7idu")},m(t,a){(0,o.b)(t,n,a),(0,o.b)(t,e,a),(0,o.m)(e,i),(0,o.b)(t,r,a)},p(t,n){3&n&&a!==(a=t[2](t[1]-t[0])+"")&&(0,o.v)(i,a)},d(t){t&&(0,o.d)(n),t&&(0,o.d)(e),t&&(0,o.d)(r)}}}function w(t){let n,e=t[0]&&x(t);return{c(){n=(0,o.j)("div"),e&&e.c(),(0,o.k)(n,"class","time svelte-pm7idu")},m(t,i){(0,o.b)(t,n,i),e&&e.m(n,null)},p(t,[o]){t[0]?e?e.p(t,o):(e=x(t),e.c(),e.m(n,null)):e&&(e.d(1),e=null)},i:o.n,o:o.n,d(t){t&&(0,o.d)(n),e&&e.d()}}}function $(t,n,e){let r,a;(0,o.c)(t,i._,(t=>e(3,r=t))),(0,o.c)(t,i.Hg,(t=>e(4,a=t)));let{startTime:s}=n,l=Date.now();const c=setInterval((()=>{e(1,l=Date.now())}),1e3);return(0,o.al)((()=>{clearInterval(c)})),t.$$set=t=>{"startTime"in t&&e(0,s=t.startTime)},[s,l,function(t){const n=Math.floor(t/1e3),e=n<0?0:n;return e>=60?`${Math.floor(e/60).toLocaleString(a)} ${r("notify.time.minutes")}`:`${e.toLocaleString(a)} ${r("notify.time.seconds")}`}]}class j extends o.S{constructor(t){super(),(0,o.i)(this,t,$,w,o.s,{startTime:0},k)}}function z(t){(0,o.a)(t,"svelte-1otz6tt","div.notify-transaction-data.svelte-1otz6tt{font-size:var(\n --notify-onboard-transaction-font-size,\n var(--onboard-font-size-6, var(--font-size-6))\n );font-family:inherit;margin:0px 20px 0px 8px;justify-content:center}.hash-time.svelte-1otz6tt{display:inline-flex;margin-top:4px;font-size:var(\n --notify-onboard-hash-time-font-size,\n var(--onboard-font-size-7, var(--font-size-7))\n );line-height:var(\n --notify-onboard-hash-time-font-line-height,\n var(--onboard-font-line-height-4, var(--font-line-height-4))\n )}.address-hash.svelte-1otz6tt{color:var(\n --notify-onboard-address-hash-color,\n var(--onboard-primary-200, var(--primary-200))\n )}a.address-hash.svelte-1otz6tt{color:var(\n --notify-onboard-anchor-color,\n var(--onboard-primary-400, var(--primary-400))\n )}a.svelte-1otz6tt{display:flex;text-decoration:none;color:inherit}.transaction-status.svelte-1otz6tt{color:var(--notify-onboard-transaction-status, inherit);line-height:var(\n --notify-onboard-font-size-5,\n var(--onboard-font-size-5, var(--font-size-5))\n );font-weight:400;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}")}function C(t){let n,e,i,r;function a(t,n){return t[0].link?P:L}let s=a(t),l=s(t);return i=new j({props:{startTime:t[0].startTime}}),{c(){n=(0,o.j)("span"),l.c(),e=(0,o.G)(),(0,o.F)(i.$$.fragment),(0,o.k)(n,"class","hash-time svelte-1otz6tt")},m(t,a){(0,o.b)(t,n,a),l.m(n,null),(0,o.m)(n,e),(0,o.I)(i,n,null),r=!0},p(t,o){s===(s=a(t))&&l?l.p(t,o):(l.d(1),l=s(t),l&&(l.c(),l.m(n,e)));const r={};1&o&&(r.startTime=t[0].startTime),i.$set(r)},i(t){r||((0,o.x)(i.$$.fragment,t),r=!0)},o(t){(0,o.A)(i.$$.fragment,t),r=!1},d(t){t&&(0,o.d)(n),l.d(),(0,o.K)(i)}}}function L(t){let n,e,i=(0,o.E)(t[0].id)+"";return{c(){n=(0,o.j)("div"),e=(0,o.t)(i),(0,o.k)(n,"class","address-hash svelte-1otz6tt")},m(t,i){(0,o.b)(t,n,i),(0,o.m)(n,e)},p(t,n){1&n&&i!==(i=(0,o.E)(t[0].id)+"")&&(0,o.v)(e,i)},d(t){t&&(0,o.d)(n)}}}function P(t){let n,e,i,r=(0,o.E)(t[0].id)+"";return{c(){n=(0,o.j)("a"),e=(0,o.t)(r),(0,o.k)(n,"class","address-hash svelte-1otz6tt"),(0,o.k)(n,"href",i=t[0].link),(0,o.k)(n,"target","_blank"),(0,o.k)(n,"rel","noreferrer noopener")},m(t,i){(0,o.b)(t,n,i),(0,o.m)(n,e)},p(t,a){1&a&&r!==(r=(0,o.E)(t[0].id)+"")&&(0,o.v)(e,r),1&a&&i!==(i=t[0].link)&&(0,o.k)(n,"href",i)},d(t){t&&(0,o.d)(n)}}}function T(t){let n,e,i,r,a,s=t[0].message+"",l=t[0].id&&!t[0].id.includes("customNotification")&&!t[0].id.includes("preflight"),c=l&&C(t);return{c(){n=(0,o.j)("div"),e=(0,o.j)("span"),i=(0,o.t)(s),r=(0,o.G)(),c&&c.c(),(0,o.k)(e,"class","transaction-status svelte-1otz6tt"),(0,o.k)(n,"class","flex flex-column notify-transaction-data svelte-1otz6tt")},m(t,s){(0,o.b)(t,n,s),(0,o.m)(n,e),(0,o.m)(e,i),(0,o.m)(n,r),c&&c.m(n,null),a=!0},p(t,[e]){(!a||1&e)&&s!==(s=t[0].message+"")&&(0,o.v)(i,s),1&e&&(l=t[0].id&&!t[0].id.includes("customNotification")&&!t[0].id.includes("preflight")),l?c?(c.p(t,e),1&e&&(0,o.x)(c,1)):(c=C(t),c.c(),(0,o.x)(c,1),c.m(n,null)):c&&((0,o.y)(),(0,o.A)(c,1,1,(()=>{c=null})),(0,o.z)())},i(t){a||((0,o.x)(c),a=!0)},o(t){(0,o.A)(c),a=!1},d(t){t&&(0,o.d)(n),c&&c.d()}}}function S(t,n,e){let{notification:o}=n;return t.$$set=t=>{"notification"in t&&e(0,o=t.notification)},[o]}class A extends o.S{constructor(t){super(),(0,o.i)(this,t,S,T,o.s,{notification:0},z)}}const M=["txPool"],F=["main","matic-main"],G=["Ledger","Trezor","Keystone","KeepKey","D'CENT"],H=t=>M.includes(t),I=t=>F.includes(t),E=t=>t&&G.includes(t.label);async function R({type:t,wallet:n,transaction:e}){const{from:i,input:r,value:a,to:l,nonce:c,gas:d,network:f}=e,p=o.ap[f],{gasPriceProbability:v}=o.a3.get().notify.replacement,{gas:u,apiKey:y}=o.af,[m]=await u.get({chains:[o.ap[f]],endpoint:"blockPrices",apiKey:y}),{maxFeePerGas:b,maxPriorityFeePerGas:h}=m.blockPrices[0].estimatedPrices.find((({confidence:n})=>n===("speedup"===t?v.speedup:v.cancel))),g=(0,o.aq)(b),k=(0,o.aq)(h),x="0x"===r?{}:{data:r};return n.provider.request({method:"eth_sendTransaction",params:[{type:"0x2",from:i,to:"cancel"===t?i:l,chainId:parseInt(p),value:`${s.gH.from(a).toHexString()}`,nonce:(0,o.ar)(c),gasLimit:(0,o.ar)(d),maxFeePerGas:g,maxPriorityFeePerGas:k,...x}]})}function K(t){(0,o.a)(t,"svelte-ftkynd",".bn-notify-notification.svelte-ftkynd.svelte-ftkynd.svelte-ftkynd{--backround-color:var(--notify-onboard-background, var(--w3o-backround-color, var(--gray-700)));--foreground-color:var(--w3o-foreground-color, var(--gray-600));--text-color:var(--w3o-text-color, #FFF);--border-color:var(--w3o-border-color);font-family:inherit;transition:background 300ms ease-in-out, color 300ms ease-in-out;pointer-events:all;backdrop-filter:blur(5px);width:100%;min-height:56px;display:flex;flex-direction:column;position:relative;overflow:hidden;border:1px solid transparent;border-radius:var(\n --notify-onboard-border-radius,\n var(--onboard-border-radius-4, var(--border-radius-4))\n );background:var(--foreground-color);color:var(--text-color)}.bn-notify-notification-inner.svelte-ftkynd.svelte-ftkynd.svelte-ftkynd{padding:0.75rem}.bn-notify-notification.svelte-ftkynd:hover>div.bn-notify-notification-inner.svelte-ftkynd>div.notify-close-btn-desktop.svelte-ftkynd{visibility:visible;opacity:1}div.notify-close-btn.svelte-ftkynd.svelte-ftkynd.svelte-ftkynd{margin-left:auto;margin-bottom:auto;height:24px;width:24px;position:absolute;top:8px;right:8px;justify-content:center;align-items:center}div.notify-close-btn-desktop.svelte-ftkynd.svelte-ftkynd.svelte-ftkynd{visibility:hidden;transition:visibility 0.15s linear, opacity 0.15s linear;opacity:0}.notify-close-btn.svelte-ftkynd .close-icon.svelte-ftkynd.svelte-ftkynd{width:20px;margin:auto;color:var(--text-color)}.notify-close-btn.svelte-ftkynd>.close-icon.svelte-ftkynd.svelte-ftkynd{color:var(--notify-onboard-close-icon-color)}.notify-close-btn.svelte-ftkynd:hover>.close-icon.svelte-ftkynd.svelte-ftkynd{color:var(--notify-onboard-close-icon-hover)}.transaction-status.svelte-ftkynd.svelte-ftkynd.svelte-ftkynd{color:var(\n --notify-onboard-transaction-status-color,\n var(--onboard-primary-100, var(--primary-100))\n );line-height:14px}.dropdown.svelte-ftkynd.svelte-ftkynd.svelte-ftkynd{height:0px;overflow:hidden;transition:height 150ms ease-in-out}.dropdown-visible.svelte-ftkynd.svelte-ftkynd.svelte-ftkynd{height:48px}.dropdown-buttons.svelte-ftkynd.svelte-ftkynd.svelte-ftkynd{background-color:var(\n --notify-onboard-dropdown-background,\n var(--onboard-gray-700, var(--gray-700))\n );width:100%;padding:8px}.dropdown-button.svelte-ftkynd.svelte-ftkynd.svelte-ftkynd{padding:4px 12px;border-radius:var(\n --notify-onboard-dropdown-border-radius,\n var(--onboard-border-radius-5, var(--border-radius-5))\n );background-color:transparent;font-size:var(\n --notify-onboard-dropdown-font-size,\n var(--onboard-font-size-6, var(--font-size-6))\n );color:var(\n --notify-onboard-dropdown-text-color,\n var(--onboard-primary-400, var(--primary-400))\n );transition:all 150ms ease-in-out;cursor:pointer}.dropdown-button.svelte-ftkynd.svelte-ftkynd.svelte-ftkynd:hover{background:var(\n --notify-onboard-dropdown-btn-hover-background,\n rgba(146, 155, 237, 0.2)\n )}")}function _(t){let n,e,i,r,a,s;return{c(){n=(0,o.j)("div"),e=(0,o.j)("button"),e.textContent="Cancel",i=(0,o.G)(),r=(0,o.j)("button"),r.textContent="Speed-up",(0,o.k)(e,"class","dropdown-button svelte-ftkynd"),(0,o.k)(r,"class","dropdown-button svelte-ftkynd"),(0,o.k)(n,"class","dropdown-buttons flex items-center justify-end svelte-ftkynd")},m(l,c){(0,o.b)(l,n,c),(0,o.m)(n,e),(0,o.m)(n,i),(0,o.m)(n,r),a||(s=[(0,o.p)(e,"click",t[9]),(0,o.p)(r,"click",t[10])],a=!0)},p:o.n,d(t){t&&(0,o.d)(n),a=!1,(0,o.L)(s)}}}function D(t){let n,e,i,r,a,s,l,c,d,f,p,v,u,y;i=new g({props:{notification:t[0],chainStyles:o.as[o.ap[t[0].network]]}}),a=new A({props:{notification:t[0]}});let m="txPool"===t[0].eventCode&&_(t);return{c(){n=(0,o.j)("div"),e=(0,o.j)("div"),(0,o.F)(i.$$.fragment),r=(0,o.G)(),(0,o.F)(a.$$.fragment),s=(0,o.G)(),l=(0,o.j)("div"),c=(0,o.j)("div"),d=(0,o.G)(),f=(0,o.j)("div"),m&&m.c(),(0,o.k)(c,"class","flex items-center close-icon svelte-ftkynd"),(0,o.k)(l,"class","notify-close-btn notify-close-btn-"+t[4].type+" pointer flex svelte-ftkynd"),(0,o.k)(e,"class","flex bn-notify-notification-inner svelte-ftkynd"),(0,o.k)(f,"class","dropdown svelte-ftkynd"),(0,o.H)(f,"dropdown-visible",t[2]&&t[5]&&H(t[0].eventCode)&&I(t[0].network)&&E(t[7])),(0,o.k)(n,"class",p="bn-notify-notification bn-notify-notification-"+t[0].type+"} svelte-ftkynd"),(0,o.H)(n,"bn-notify-clickable",t[0].onClick)},m(p,b){(0,o.b)(p,n,b),(0,o.m)(n,e),(0,o.I)(i,e,null),(0,o.m)(e,r),(0,o.I)(a,e,null),(0,o.m)(e,s),(0,o.m)(e,l),(0,o.m)(l,c),c.innerHTML='\n\n \n\n',(0,o.m)(n,d),(0,o.m)(n,f),m&&m.m(f,null),v=!0,u||(y=[(0,o.p)(l,"click",(0,o.J)(t[8])),(0,o.p)(n,"mouseenter",t[11]),(0,o.p)(n,"mouseleave",t[12]),(0,o.p)(n,"click",t[13])],u=!0)},p(t,[e]){const r={};1&e&&(r.notification=t[0]),1&e&&(r.chainStyles=o.as[o.ap[t[0].network]]),i.$set(r);const s={};1&e&&(s.notification=t[0]),a.$set(s),"txPool"===t[0].eventCode?m?m.p(t,e):(m=_(t),m.c(),m.m(f,null)):m&&(m.d(1),m=null),(!v||165&e)&&(0,o.H)(f,"dropdown-visible",t[2]&&t[5]&&H(t[0].eventCode)&&I(t[0].network)&&E(t[7])),(!v||1&e&&p!==(p="bn-notify-notification bn-notify-notification-"+t[0].type+"} svelte-ftkynd"))&&(0,o.k)(n,"class",p),(!v||1&e)&&(0,o.H)(n,"bn-notify-clickable",t[0].onClick)},i(t){v||((0,o.x)(i.$$.fragment,t),(0,o.x)(a.$$.fragment,t),v=!0)},o(t){(0,o.A)(i.$$.fragment,t),(0,o.A)(a.$$.fragment,t),v=!1},d(t){t&&(0,o.d)(n),(0,o.K)(i),(0,o.K)(a),m&&m.d(),u=!1,(0,o.L)(y)}}}function N(t,n,e){let r,a;(0,o.c)(t,o.w,(t=>e(15,r=t))),(0,o.c)(t,i._,(t=>e(3,a=t)));const{device:s,gas:l}=o.af;let c,{notification:d}=n,{updateParentOnRemove:f}=n,p=!1;const v=o.at.getValue().find((({hash:t})=>t===d.id)),u=v&&r.find((({accounts:t})=>!!t.find((({address:t})=>t.toLowerCase()===v.from.toLowerCase()))));return(0,o.al)((()=>{clearTimeout(c)})),t.$$set=t=>{"notification"in t&&e(0,d=t.notification),"updateParentOnRemove"in t&&e(1,f=t.updateParentOnRemove)},t.$$.update=()=>{1&t.$$.dirty&&d.autoDismiss&&(c=setTimeout((()=>{(0,o.au)(d.id),(0,o.av)(d.id)}),d.autoDismiss))},[d,f,p,a,s,l,v,u,()=>{(0,o.au)(d.id),(0,o.av)(d.id),f()},async()=>{try{await R({type:"cancel",wallet:u,transaction:v})}catch(t){const n=`${v.hash.slice(0,9)}:txReplaceError${v.hash.slice(-5)}`;(0,o.aw)({id:n,type:"hint",eventCode:"txError",message:a("notify.transaction.txReplaceError"),key:n,autoDismiss:4e3})}},async()=>{try{await R({type:"speedup",wallet:u,transaction:v})}catch(t){const n=`${v.hash.slice(0,9)}:txReplaceError${v.hash.slice(-5)}`;(0,o.aw)({id:n,type:"hint",eventCode:"txError",message:a("notify.transaction.txReplaceError"),key:n,autoDismiss:4e3})}},()=>e(2,p=!0),()=>e(2,p=!1),t=>d.onClick&&d.onClick(t)]}class V extends o.S{constructor(t){super(),(0,o.i)(this,t,N,D,o.s,{notification:0,updateParentOnRemove:1},K)}}function O(t){(0,o.a)(t,"svelte-1h8mmo3","ul.svelte-1h8mmo3{padding-left:0;display:flex;flex-flow:column nowrap;font-size:var(\n --notify-onboard-font-size,\n var(--onboard-font-size-5, var(--font-size-5))\n );list-style-type:none;overflow:visible;scrollbar-width:none;box-sizing:border-box;z-index:var(--notify-onboard-z-index, 300);font-family:var(\n --notify-onboard-font-family,\n var(--onboard-font-family-normal, inherit)\n );margin:8px 0;pointer-events:all}.y-scroll.svelte-1h8mmo3{overflow-y:scroll}.y-visible.svelte-1h8mmo3{overflow-y:visible}li.notification-list-top.svelte-1h8mmo3:not(:first-child){margin-top:8px}li.notification-list-bottom.svelte-1h8mmo3:not(:first-child){margin-bottom:8px}ul.bn-notify-bottomLeft.svelte-1h8mmo3,ul.bn-notify-bottomRight.svelte-1h8mmo3{flex-direction:column-reverse}@media only screen and (max-width: 450px){ul.svelte-1h8mmo3{width:100%}}.bn-notify-clickable:hover{cursor:pointer}.svelte-1h8mmo3::-webkit-scrollbar{display:none}")}function q(t,n,e){const o=t.slice();return o[12]=n[e],o}function Z(t){let n,e,i,r,a=[],s=new Map,l=t[2];const c=t=>t[12].key;for(let n=0;n{f&&(c&&c.end(1),s=(0,o.V)(e,o.ab,{duration:1200,delay:300,x:n[3],y:n[4],easing:U}),s.start())})),f=!0)},o(t){(0,o.A)(i.$$.fragment,t),s&&s.invalidate(),c=(0,o.ak)(e,o.X,{duration:300,easing:o.an}),f=!1},d(t){t&&(0,o.d)(e),(0,o.K)(i),t&&c&&c.end(),p=!1,v()}}}function J(t){let n,e,i=t[2].length&&Z(t);return{c(){i&&i.c(),n=(0,o.e)()},m(t,r){i&&i.m(t,r),(0,o.b)(t,n,r),e=!0},p(t,[e]){t[2].length?i?(i.p(t,e),4&e&&(0,o.x)(i,1)):(i=Z(t),i.c(),(0,o.x)(i,1),i.m(n.parentNode,n)):i&&((0,o.y)(),(0,o.A)(i,1,1,(()=>{i=null})),(0,o.z)())},i(t){e||((0,o.x)(i),e=!0)},o(t){(0,o.A)(i),e=!1},d(t){i&&i.d(t),t&&(0,o.d)(n)}}}function U(t){return Math.sin(-13*(t+1)*Math.PI/2)*Math.pow(2,-35*t)+1}function X(t,n,e){let i;const{device:s}=o.af,l=o.a3.select("accountCenter").pipe((0,r.Z)(o.a3.get().accountCenter),(0,a.t)(1));(0,o.c)(t,l,(t=>e(6,i=t)));let c,d,{position:f}=n,{sharedContainer:p}=n,{notifications:v}=n;c=0,d=0;let u="y-scroll";const y=function(){let t=null;return(n,e)=>{clearTimeout(t),t=setTimeout(n,e)}}();return t.$$set=t=>{"position"in t&&e(0,f=t.position),"sharedContainer"in t&&e(1,p=t.sharedContainer),"notifications"in t&&e(2,v=t.notifications)},t.$$.update=()=>{1&t.$$.dirty&&(f.includes("top")?e(4,d=-50):e(4,d=50))},[f,p,v,0,d,u,i,s,l,()=>{"y-visible"!==u&&e(5,u="y-visible"),y((function(){e(5,u="y-scroll")}),1e3)},function(n){o.ai.call(this,t,n)}]}class Q extends o.S{constructor(t){super(),(0,o.i)(this,t,X,J,o.s,{position:0,sharedContainer:1,notifications:2},O)}}}}]); \ No newline at end of file diff --git a/gateway/dist/2815.fcefde563530f833b75c.bundle.js b/gateway/dist/2815.fcefde563530f833b75c.bundle.js new file mode 100644 index 00000000..d0bdfc69 --- /dev/null +++ b/gateway/dist/2815.fcefde563530f833b75c.bundle.js @@ -0,0 +1,190 @@ +/*! For license information please see 2815.fcefde563530f833b75c.bundle.js.LICENSE.txt */ +(self.webpackChunkbos_workspace_gateway=self.webpackChunkbos_workspace_gateway||[]).push([[2815],{82815:function(e,t,n){var r=n(65606),i=n(48287).Buffer;!function(e){"use strict";let t=!1;const o=e=>(n,...r)=>{t&&console.debug(`[${e}] ${n}`,...r)},s=e=>(t,...n)=>{console.error(`[${e}] ${t}`,...n)};class a extends Error{constructor(){super(),this.name=this.constructor.name,this.message="The Ledger Extension was not found."}}class c extends Error{constructor(){super(),this.name=this.constructor.name,this.message="The specified provider is not supported."}}class u extends Error{constructor(){super(),this.name=this.constructor.name,this.code=4001,this.message="User rejected request"}}class l extends Error{constructor(){super(),this.message="Connect Kit does not support server side."}}function f(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function d(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function p(e){var t=e.default;if("function"==typeof t){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var g={exports:{}};!function(e,t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=63)}([function(e,t,n){(function(e){n.d(t,"f",(function(){return a})),n.d(t,"g",(function(){return c})),n.d(t,"i",(function(){return u})),n.d(t,"h",(function(){return l})),n.d(t,"b",(function(){return f})),n.d(t,"c",(function(){return h})),n.d(t,"e",(function(){return d})),n.d(t,"d",(function(){return p})),n.d(t,"o",(function(){return g})),n.d(t,"n",(function(){return y})),n.d(t,"q",(function(){return m})),n.d(t,"p",(function(){return v})),n.d(t,"D",(function(){return _})),n.d(t,"C",(function(){return b})),n.d(t,"E",(function(){return w})),n.d(t,"F",(function(){return E})),n.d(t,"w",(function(){return S})),n.d(t,"v",(function(){return O})),n.d(t,"x",(function(){return R})),n.d(t,"y",(function(){return I})),n.d(t,"t",(function(){return P})),n.d(t,"s",(function(){return k})),n.d(t,"u",(function(){return N})),n.d(t,"r",(function(){return A})),n.d(t,"m",(function(){return T})),n.d(t,"l",(function(){return M})),n.d(t,"k",(function(){return L})),n.d(t,"j",(function(){return U})),n.d(t,"A",(function(){return D})),n.d(t,"a",(function(){return z})),n.d(t,"B",(function(){return B})),n.d(t,"z",(function(){return F}));var r=n(22),i=n.n(r),o=n(58),s=n.n(o);function a(e){return new Uint8Array(e)}function c(e,t=!1){const n=e.toString("hex");return t?z(n):n}function u(e){return e.toString("utf8")}function l(e){return e.readUIntBE(0,e.length)}function f(e){return s()(e)}function h(e,t=!1){return c(f(e),t)}function d(e){return u(f(e))}function p(e){return l(f(e))}function g(t){return e.from(D(t),"hex")}function y(e){return a(g(e))}function m(e){return u(g(e))}function v(e){return p(y(e))}function _(t){return e.from(t,"utf8")}function b(e){return a(_(e))}function w(e,t=!1){return c(_(e),t)}function E(e){const t=parseInt(e,10);return function(e,t){if(!e)throw new Error("Number can only safely store up to 53 bits")}(!function(e){return void 0===e}(t)),t}function S(e){return f(C(x(e)))}function O(e){return C(x(e))}function R(e,t){return function(e,t){return h(C(e),t)}(x(e),t)}function I(e){return""+e}function x(e){return j((e>>>0).toString(2))}function C(e){return new Uint8Array(function(e,t=8){const n=j(e).match(new RegExp(`.{${t}}`,"gi"));return Array.from(n||[])}(e).map((e=>parseInt(e,2))))}function P(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}function k(t){return e.isBuffer(t)}function N(e){return i.a.strict(e)&&!k(e)}function A(e){return!N(e)&&!k(e)&&void 0!==e.byteLength}function T(e){return k(e)?"buffer":N(e)?"typed-array":A(e)?"array-buffer":Array.isArray(e)?"array":typeof e}function M(e){return function(e){return!("string"!=typeof e||!new RegExp(/^[01]+$/).test(e))&&e.length%8==0}(e)?"binary":P(e)?"hex":"utf8"}function L(...t){return e.concat(t)}function U(...e){let t=[];return e.forEach((e=>t=t.concat(Array.from(e)))),new Uint8Array([...t])}function j(e,t=8,n="0"){return function(e,t,n="0"){return function(e,t,n,r="0"){const i=t-e.length;let o=e;if(i>0){const t=r.repeat(i);o=n?t+e:e+t}return o}(e,t,!0,n)}(e,function(e,t=8){const n=e%t;return n?(e-n)/t*t+t:e}(e.length,t),n)}function D(e){return e.replace(/^0x/,"")}function z(e){return e.startsWith("0x")?e:"0x"+e}function B(e){return(e=j(e=D(e),2))&&(e=z(e)),e}function F(e){const t=e.startsWith("0x");return e=(e=D(e)).startsWith("0")?e.substring(1):e,t?z(e):e}}).call(this,n(44).Buffer)},function(e,t,n){n.r(t),n.d(t,"convertArrayBufferToBuffer",(function(){return i})),n.d(t,"convertArrayBufferToUtf8",(function(){return o})),n.d(t,"convertArrayBufferToHex",(function(){return s})),n.d(t,"convertArrayBufferToNumber",(function(){return a})),n.d(t,"concatArrayBuffers",(function(){return c})),n.d(t,"convertBufferToArrayBuffer",(function(){return u})),n.d(t,"convertBufferToUtf8",(function(){return l})),n.d(t,"convertBufferToHex",(function(){return f})),n.d(t,"convertBufferToNumber",(function(){return h})),n.d(t,"concatBuffers",(function(){return d})),n.d(t,"convertUtf8ToArrayBuffer",(function(){return p})),n.d(t,"convertUtf8ToBuffer",(function(){return g})),n.d(t,"convertUtf8ToHex",(function(){return y})),n.d(t,"convertUtf8ToNumber",(function(){return m})),n.d(t,"convertHexToBuffer",(function(){return v})),n.d(t,"convertHexToArrayBuffer",(function(){return _})),n.d(t,"convertHexToUtf8",(function(){return b})),n.d(t,"convertHexToNumber",(function(){return w})),n.d(t,"convertNumberToBuffer",(function(){return E})),n.d(t,"convertNumberToArrayBuffer",(function(){return S})),n.d(t,"convertNumberToUtf8",(function(){return O})),n.d(t,"convertNumberToHex",(function(){return R})),n.d(t,"detectEnv",(function(){return B})),n.d(t,"detectOS",(function(){return F})),n.d(t,"isAndroid",(function(){return H})),n.d(t,"isIOS",(function(){return q})),n.d(t,"isMobile",(function(){return $})),n.d(t,"isNode",(function(){return V})),n.d(t,"isBrowser",(function(){return W})),n.d(t,"safeJsonParse",(function(){return G})),n.d(t,"safeJsonStringify",(function(){return Y})),n.d(t,"setLocal",(function(){return Q})),n.d(t,"getLocal",(function(){return J})),n.d(t,"removeLocal",(function(){return X})),n.d(t,"getClientMeta",(function(){return ee})),n.d(t,"sanitizeHex",(function(){return re})),n.d(t,"addHexPrefix",(function(){return ie})),n.d(t,"removeHexPrefix",(function(){return oe})),n.d(t,"removeHexLeadingZeros",(function(){return se})),n.d(t,"payloadId",(function(){return ae})),n.d(t,"uuid",(function(){return ce})),n.d(t,"logDeprecationWarning",(function(){return ue})),n.d(t,"getInfuraRpcUrl",(function(){return le})),n.d(t,"getRpcUrl",(function(){return fe})),n.d(t,"formatIOSMobile",(function(){return he})),n.d(t,"saveMobileLinkInfo",(function(){return de})),n.d(t,"getMobileRegistryEntry",(function(){return pe})),n.d(t,"getMobileLinkRegistry",(function(){return ge})),n.d(t,"promisify",(function(){return ye})),n.d(t,"formatRpcError",(function(){return me})),n.d(t,"getWalletRegistryUrl",(function(){return _e})),n.d(t,"getDappRegistryUrl",(function(){return be})),n.d(t,"formatMobileRegistryEntry",(function(){return we})),n.d(t,"formatMobileRegistry",(function(){return Ee})),n.d(t,"isWalletConnectSession",(function(){return Ce})),n.d(t,"parseWalletConnectUri",(function(){return Pe})),n.d(t,"getQueryString",(function(){return Oe})),n.d(t,"appendToQueryString",(function(){return Re})),n.d(t,"parseQueryString",(function(){return Ie})),n.d(t,"formatQueryString",(function(){return xe})),n.d(t,"isEmptyString",(function(){return ke})),n.d(t,"isEmptyArray",(function(){return Ne})),n.d(t,"isBuffer",(function(){return Ae})),n.d(t,"isTypedArray",(function(){return Te})),n.d(t,"isArrayBuffer",(function(){return Me})),n.d(t,"getType",(function(){return Le})),n.d(t,"getEncoding",(function(){return Ue})),n.d(t,"isHexString",(function(){return je})),n.d(t,"isJsonRpcSubscription",(function(){return De})),n.d(t,"isJsonRpcRequest",(function(){return ze})),n.d(t,"isJsonRpcResponseSuccess",(function(){return Be})),n.d(t,"isJsonRpcResponseError",(function(){return Fe})),n.d(t,"isInternalEvent",(function(){return He})),n.d(t,"isReservedEvent",(function(){return qe})),n.d(t,"isSilentPayload",(function(){return $e})),n.d(t,"getFromWindow",(function(){return C})),n.d(t,"getFromWindowOrThrow",(function(){return P})),n.d(t,"getDocumentOrThrow",(function(){return k})),n.d(t,"getDocument",(function(){return N})),n.d(t,"getNavigatorOrThrow",(function(){return A})),n.d(t,"getNavigator",(function(){return T})),n.d(t,"getLocationOrThrow",(function(){return M})),n.d(t,"getLocation",(function(){return L})),n.d(t,"getCryptoOrThrow",(function(){return U})),n.d(t,"getCrypto",(function(){return j})),n.d(t,"getLocalStorageOrThrow",(function(){return D})),n.d(t,"getLocalStorage",(function(){return z}));var r=n(0);function i(e){return r.b(new Uint8Array(e))}function o(e){return r.e(new Uint8Array(e))}function s(e,t){return r.c(new Uint8Array(e),!t)}function a(e){return r.d(new Uint8Array(e))}function c(...e){return r.n(e.map((e=>r.c(new Uint8Array(e)))).join("")).buffer}function u(e){return r.f(e).buffer}function l(e){return r.i(e)}function f(e,t){return r.g(e,!t)}function h(e){return r.h(e)}function d(...e){return r.k(...e)}function p(e){return r.C(e).buffer}function g(e){return r.D(e)}function y(e,t){return r.E(e,!t)}function m(e){return r.F(e)}function v(e){return r.o(e)}function _(e){return r.n(e).buffer}function b(e){return r.q(e)}function w(e){return r.p(e)}function E(e){return r.w(e)}function S(e){return r.v(e).buffer}function O(e){return r.y(e)}function R(e,t){return r.x(Number(e),!t)}var I=n(59),x=n(6);const C=x.getFromWindow,P=x.getFromWindowOrThrow,k=x.getDocumentOrThrow,N=x.getDocument,A=x.getNavigatorOrThrow,T=x.getNavigator,M=x.getLocationOrThrow,L=x.getLocation,U=x.getCryptoOrThrow,j=x.getCrypto,D=x.getLocalStorageOrThrow,z=x.getLocalStorage;function B(e){return Object(I.a)(e)}function F(){const e=B();return e&&e.os?e.os:void 0}function H(){const e=F();return!!e&&e.toLowerCase().includes("android")}function q(){const e=F();return!!e&&(e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1)}function $(){return!!F()&&(H()||q())}function V(){const e=B();return!(!e||!e.name)&&"node"===e.name.toLowerCase()}function W(){return!V()&&!!T()}var K=n(12);const G=K.a,Y=K.b;function Q(e,t){const n=Y(t),r=z();r&&r.setItem(e,n)}function J(e){let t=null,n=null;const r=z();return r&&(n=r.getItem(e)),t=n?G(n):n,t}function X(e){const t=z();t&&t.removeItem(e)}var Z=n(60);function ee(){return Z.getWindowMetadata()}var te=n(7),ne=n(2);function re(e){return r.B(e)}function ie(e){return r.a(e)}function oe(e){return r.A(e)}function se(e){return r.z(r.a(e))}const ae=te.payloadId;function ce(){return((e,t)=>{for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t})()}function ue(){console.warn("DEPRECATION WARNING: This WalletConnect client library will be deprecated in favor of @walletconnect/client. Please check docs.walletconnect.org to learn more about this migration!")}function le(e,t){let n;const r=ne.INFURA_NETWORKS[e];return r&&(n=`https://${r}.infura.io/v3/${t}`),n}function fe(e,t){let n;const r=le(e,t.infuraId);return t.custom&&t.custom[e]?n=t.custom[e]:r&&(n=r),n}function he(e,t){const n=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${n}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${n}`:""}function de(e){const t=e.href.split("?")[0];Q(ne.MOBILE_LINK_CHOICE_KEY,Object.assign(Object.assign({},e),{href:t}))}function pe(e,t){return e.filter((e=>e.name.toLowerCase().includes(t.toLowerCase())))[0]}function ge(e,t){let n=e;return t&&(n=t.map((t=>pe(e,t))).filter(Boolean)),n}function ye(e,t){return async(...n)=>new Promise(((r,i)=>{e.apply(t,[...n,(e,t)=>{null==e&&i(e),r(t)}])}))}function me(e){const t=e.message||"Failed or Rejected Request";let n=-32e3;if(e&&!e.code)switch(t){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3}const r={code:n,message:t};return e.data&&(r.data=e.data),r}const ve="https://registry.walletconnect.com";function _e(){return ve+"/api/v2/wallets"}function be(){return ve+"/api/v2/dapps"}function we(e,t="mobile"){var n;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:null!==(n=e.image_url.sm)&&void 0!==n?n:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}function Ee(e,t="mobile"){return Object.values(e).filter((e=>!!e[t].universal||!!e[t].native)).map((e=>we(e,t)))}var Se=n(24);function Oe(e){const t=-1!==e.indexOf("?")?e.indexOf("?"):void 0;return void 0!==t?e.substr(t):""}function Re(e,t){let n=Ie(e);return n=Object.assign(Object.assign({},n),t),xe(n)}function Ie(e){return Se.parse(e)}function xe(e){return Se.stringify(e)}function Ce(e){return void 0!==e.bridge}function Pe(e){const t=e.indexOf(":"),n=-1!==e.indexOf("?")?e.indexOf("?"):void 0,r=e.substring(0,t),i=function(e){const t=e.split("@");return{handshakeTopic:t[0],version:parseInt(t[1],10)}}(e.substring(t+1,n)),o=function(e){const t=Ie(e);return{key:t.key||"",bridge:t.bridge||""}}(void 0!==n?e.substr(n):"");return Object.assign(Object.assign({protocol:r},i),o)}function ke(e){return""===e||"string"==typeof e&&""===e.trim()}function Ne(e){return!(e&&e.length)}function Ae(e){return r.s(e)}function Te(e){return r.u(e)}function Me(e){return r.r(e)}function Le(e){return r.m(e)}function Ue(e){return r.l(e)}function je(e,t){return r.t(e,t)}function De(e){return"object"==typeof e.params}function ze(e){return void 0!==e.method}function Be(e){return void 0!==e.result}function Fe(e){return void 0!==e.error}function He(e){return void 0!==e.event}function qe(e){return ne.RESERVED_EVENTS.includes(e)||e.startsWith("wc_")}function $e(e){return!!e.method.startsWith("wc_")||!ne.SIGNING_METHODS.includes(e.method)}},function(e,t,n){n.r(t);var r=n(34);for(var i in r)["default"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(i);var o=n(57);n.d(t,"ERROR_SESSION_CONNECTED",(function(){return o.k})),n.d(t,"ERROR_SESSION_DISCONNECTED",(function(){return o.l})),n.d(t,"ERROR_SESSION_REJECTED",(function(){return o.m})),n.d(t,"ERROR_MISSING_JSON_RPC",(function(){return o.e})),n.d(t,"ERROR_MISSING_RESULT",(function(){return o.h})),n.d(t,"ERROR_MISSING_ERROR",(function(){return o.c})),n.d(t,"ERROR_MISSING_METHOD",(function(){return o.f})),n.d(t,"ERROR_MISSING_ID",(function(){return o.d})),n.d(t,"ERROR_MISSING_REQUIRED",(function(){return o.g})),n.d(t,"ERROR_INVALID_RESPONSE",(function(){return o.a})),n.d(t,"ERROR_INVALID_URI",(function(){return o.b})),n.d(t,"ERROR_QRCODE_MODAL_NOT_PROVIDED",(function(){return o.i})),n.d(t,"ERROR_QRCODE_MODAL_USER_CLOSED",(function(){return o.j})),n.d(t,"RESERVED_EVENTS",(function(){return o.p})),n.d(t,"reservedEvents",(function(){return o.v})),n.d(t,"WALLET_METHODS",(function(){return o.s})),n.d(t,"SIGNING_METHODS",(function(){return o.q})),n.d(t,"STATE_METHODS",(function(){return o.r})),n.d(t,"signingMethods",(function(){return o.w})),n.d(t,"stateMethods",(function(){return o.x})),n.d(t,"MOBILE_LINK_CHOICE_KEY",(function(){return o.o})),n.d(t,"mobileLinkChoiceKey",(function(){return o.u})),n.d(t,"INFURA_NETWORKS",(function(){return o.n})),n.d(t,"infuraNetworks",(function(){return o.t}));var s=n(35);for(var i in s)["default","ERROR_SESSION_CONNECTED","ERROR_SESSION_DISCONNECTED","ERROR_SESSION_REJECTED","ERROR_MISSING_JSON_RPC","ERROR_MISSING_RESULT","ERROR_MISSING_ERROR","ERROR_MISSING_METHOD","ERROR_MISSING_ID","ERROR_MISSING_REQUIRED","ERROR_INVALID_RESPONSE","ERROR_INVALID_URI","ERROR_QRCODE_MODAL_NOT_PROVIDED","ERROR_QRCODE_MODAL_USER_CLOSED","RESERVED_EVENTS","reservedEvents","WALLET_METHODS","SIGNING_METHODS","STATE_METHODS","signingMethods","stateMethods","MOBILE_LINK_CHOICE_KEY","mobileLinkChoiceKey","INFURA_NETWORKS","infuraNetworks"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return s[e]}))}(i);var a=n(36);n.d(t,"IEvents",(function(){return a.a}));var c=n(37);for(var i in c)["default","ERROR_SESSION_CONNECTED","ERROR_SESSION_DISCONNECTED","ERROR_SESSION_REJECTED","ERROR_MISSING_JSON_RPC","ERROR_MISSING_RESULT","ERROR_MISSING_ERROR","ERROR_MISSING_METHOD","ERROR_MISSING_ID","ERROR_MISSING_REQUIRED","ERROR_INVALID_RESPONSE","ERROR_INVALID_URI","ERROR_QRCODE_MODAL_NOT_PROVIDED","ERROR_QRCODE_MODAL_USER_CLOSED","RESERVED_EVENTS","reservedEvents","WALLET_METHODS","SIGNING_METHODS","STATE_METHODS","signingMethods","stateMethods","MOBILE_LINK_CHOICE_KEY","mobileLinkChoiceKey","INFURA_NETWORKS","infuraNetworks","IEvents"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return c[e]}))}(i);var u=n(38);for(var i in u)["default","ERROR_SESSION_CONNECTED","ERROR_SESSION_DISCONNECTED","ERROR_SESSION_REJECTED","ERROR_MISSING_JSON_RPC","ERROR_MISSING_RESULT","ERROR_MISSING_ERROR","ERROR_MISSING_METHOD","ERROR_MISSING_ID","ERROR_MISSING_REQUIRED","ERROR_INVALID_RESPONSE","ERROR_INVALID_URI","ERROR_QRCODE_MODAL_NOT_PROVIDED","ERROR_QRCODE_MODAL_USER_CLOSED","RESERVED_EVENTS","reservedEvents","WALLET_METHODS","SIGNING_METHODS","STATE_METHODS","signingMethods","stateMethods","MOBILE_LINK_CHOICE_KEY","mobileLinkChoiceKey","INFURA_NETWORKS","infuraNetworks","IEvents"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return u[e]}))}(i);var l=n(39);for(var i in l)["default","ERROR_SESSION_CONNECTED","ERROR_SESSION_DISCONNECTED","ERROR_SESSION_REJECTED","ERROR_MISSING_JSON_RPC","ERROR_MISSING_RESULT","ERROR_MISSING_ERROR","ERROR_MISSING_METHOD","ERROR_MISSING_ID","ERROR_MISSING_REQUIRED","ERROR_INVALID_RESPONSE","ERROR_INVALID_URI","ERROR_QRCODE_MODAL_NOT_PROVIDED","ERROR_QRCODE_MODAL_USER_CLOSED","RESERVED_EVENTS","reservedEvents","WALLET_METHODS","SIGNING_METHODS","STATE_METHODS","signingMethods","stateMethods","MOBILE_LINK_CHOICE_KEY","mobileLinkChoiceKey","INFURA_NETWORKS","infuraNetworks","IEvents"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return l[e]}))}(i);var f=n(40);for(var i in f)["default","ERROR_SESSION_CONNECTED","ERROR_SESSION_DISCONNECTED","ERROR_SESSION_REJECTED","ERROR_MISSING_JSON_RPC","ERROR_MISSING_RESULT","ERROR_MISSING_ERROR","ERROR_MISSING_METHOD","ERROR_MISSING_ID","ERROR_MISSING_REQUIRED","ERROR_INVALID_RESPONSE","ERROR_INVALID_URI","ERROR_QRCODE_MODAL_NOT_PROVIDED","ERROR_QRCODE_MODAL_USER_CLOSED","RESERVED_EVENTS","reservedEvents","WALLET_METHODS","SIGNING_METHODS","STATE_METHODS","signingMethods","stateMethods","MOBILE_LINK_CHOICE_KEY","mobileLinkChoiceKey","INFURA_NETWORKS","infuraNetworks","IEvents"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return f[e]}))}(i);var h=n(41);for(var i in h)["default","ERROR_SESSION_CONNECTED","ERROR_SESSION_DISCONNECTED","ERROR_SESSION_REJECTED","ERROR_MISSING_JSON_RPC","ERROR_MISSING_RESULT","ERROR_MISSING_ERROR","ERROR_MISSING_METHOD","ERROR_MISSING_ID","ERROR_MISSING_REQUIRED","ERROR_INVALID_RESPONSE","ERROR_INVALID_URI","ERROR_QRCODE_MODAL_NOT_PROVIDED","ERROR_QRCODE_MODAL_USER_CLOSED","RESERVED_EVENTS","reservedEvents","WALLET_METHODS","SIGNING_METHODS","STATE_METHODS","signingMethods","stateMethods","MOBILE_LINK_CHOICE_KEY","mobileLinkChoiceKey","INFURA_NETWORKS","infuraNetworks","IEvents"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return h[e]}))}(i);var d=n(42);for(var i in d)["default","ERROR_SESSION_CONNECTED","ERROR_SESSION_DISCONNECTED","ERROR_SESSION_REJECTED","ERROR_MISSING_JSON_RPC","ERROR_MISSING_RESULT","ERROR_MISSING_ERROR","ERROR_MISSING_METHOD","ERROR_MISSING_ID","ERROR_MISSING_REQUIRED","ERROR_INVALID_RESPONSE","ERROR_INVALID_URI","ERROR_QRCODE_MODAL_NOT_PROVIDED","ERROR_QRCODE_MODAL_USER_CLOSED","RESERVED_EVENTS","reservedEvents","WALLET_METHODS","SIGNING_METHODS","STATE_METHODS","signingMethods","stateMethods","MOBILE_LINK_CHOICE_KEY","mobileLinkChoiceKey","INFURA_NETWORKS","infuraNetworks","IEvents"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return d[e]}))}(i);var p=n(43);for(var i in p)["default","ERROR_SESSION_CONNECTED","ERROR_SESSION_DISCONNECTED","ERROR_SESSION_REJECTED","ERROR_MISSING_JSON_RPC","ERROR_MISSING_RESULT","ERROR_MISSING_ERROR","ERROR_MISSING_METHOD","ERROR_MISSING_ID","ERROR_MISSING_REQUIRED","ERROR_INVALID_RESPONSE","ERROR_INVALID_URI","ERROR_QRCODE_MODAL_NOT_PROVIDED","ERROR_QRCODE_MODAL_USER_CLOSED","RESERVED_EVENTS","reservedEvents","WALLET_METHODS","SIGNING_METHODS","STATE_METHODS","signingMethods","stateMethods","MOBILE_LINK_CHOICE_KEY","mobileLinkChoiceKey","INFURA_NETWORKS","infuraNetworks","IEvents"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return p[e]}))}(i)},function(e,t,n){n.d(t,"b",(function(){return i})),n.d(t,"g",(function(){return o})),n.d(t,"a",(function(){return s})),n.d(t,"f",(function(){return a})),n.d(t,"e",(function(){return c})),n.d(t,"i",(function(){return u})),n.d(t,"j",(function(){return l})),n.d(t,"h",(function(){return r})),n.d(t,"d",(function(){return f})),n.d(t,"c",(function(){return h})),n.d(t,"k",(function(){return d})),n.d(t,"l",(function(){return p}));const r=512,i=256,o=256,s="AES-CBC",a="SHA-"+i,c="HMAC",u="SHA-256",l="SHA-512",f="encrypt",h="decrypt",d="sign",p="verify"},function(e,t,n){n.d(t,"f",(function(){return r})),n.d(t,"d",(function(){return i})),n.d(t,"e",(function(){return o})),n.d(t,"c",(function(){return s})),n.d(t,"b",(function(){return a})),n.d(t,"h",(function(){return c})),n.d(t,"g",(function(){return u})),n.d(t,"i",(function(){return l})),n.d(t,"j",(function(){return f})),n.d(t,"a",(function(){return h}));const r="PARSE_ERROR",i="INVALID_REQUEST",o="METHOD_NOT_FOUND",s="INVALID_PARAMS",a="INTERNAL_ERROR",c="SERVER_ERROR",u=[-32700,-32600,-32601,-32602,-32603],l=[-32e3,-32099],f={[r]:{code:-32700,message:"Parse error"},[i]:{code:-32600,message:"Invalid Request"},[o]:{code:-32601,message:"Method not found"},[s]:{code:-32602,message:"Invalid params"},[a]:{code:-32603,message:"Internal error"},[c]:{code:-32e3,message:"Server error"}},h=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});const r=n(17);r.__exportStar(n(64),t),r.__exportStar(n(65),t)},function(e,t,n){function r(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function i(e){const t=r(e);if(!t)throw new Error(e+" is not defined in Window");return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=r,t.getFromWindowOrThrow=i,t.getDocumentOrThrow=function(){return i("document")},t.getDocument=function(){return r("document")},t.getNavigatorOrThrow=function(){return i("navigator")},t.getNavigator=function(){return r("navigator")},t.getLocationOrThrow=function(){return i("location")},t.getLocation=function(){return r("location")},t.getCryptoOrThrow=function(){return i("crypto")},t.getCrypto=function(){return r("crypto")},t.getLocalStorageOrThrow=function(){return i("localStorage")},t.getLocalStorage=function(){return r("localStorage")}},function(e,t,n){n.r(t);var r=n(4);n.d(t,"PARSE_ERROR",(function(){return r.f})),n.d(t,"INVALID_REQUEST",(function(){return r.d})),n.d(t,"METHOD_NOT_FOUND",(function(){return r.e})),n.d(t,"INVALID_PARAMS",(function(){return r.c})),n.d(t,"INTERNAL_ERROR",(function(){return r.b})),n.d(t,"SERVER_ERROR",(function(){return r.h})),n.d(t,"RESERVED_ERROR_CODES",(function(){return r.g})),n.d(t,"SERVER_ERROR_CODE_RANGE",(function(){return r.i})),n.d(t,"STANDARD_ERROR_MAP",(function(){return r.j})),n.d(t,"DEFAULT_ERROR",(function(){return r.a}));var i=n(11);n.d(t,"isServerErrorCode",(function(){return i.d})),n.d(t,"isReservedErrorCode",(function(){return i.c})),n.d(t,"isValidErrorCode",(function(){return i.e})),n.d(t,"getError",(function(){return i.a})),n.d(t,"getErrorByCode",(function(){return i.b})),n.d(t,"validateJsonRpcError",(function(){return i.g})),n.d(t,"parseConnectionError",(function(){return i.f}));var o=n(25);for(var s in o)["default","PARSE_ERROR","INVALID_REQUEST","METHOD_NOT_FOUND","INVALID_PARAMS","INTERNAL_ERROR","SERVER_ERROR","RESERVED_ERROR_CODES","SERVER_ERROR_CODE_RANGE","STANDARD_ERROR_MAP","DEFAULT_ERROR","isServerErrorCode","isReservedErrorCode","isValidErrorCode","getError","getErrorByCode","validateJsonRpcError","parseConnectionError"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(s);var a=n(26);n.d(t,"payloadId",(function(){return a.e})),n.d(t,"formatJsonRpcRequest",(function(){return a.c})),n.d(t,"formatJsonRpcResult",(function(){return a.d})),n.d(t,"formatJsonRpcError",(function(){return a.b})),n.d(t,"formatErrorMessage",(function(){return a.a}));var c=n(27);n.d(t,"isValidRoute",(function(){return c.c})),n.d(t,"isValidDefaultRoute",(function(){return c.a})),n.d(t,"isValidWildcardRoute",(function(){return c.e})),n.d(t,"isValidLeadingWildcardRoute",(function(){return c.b})),n.d(t,"isValidTrailingWildcardRoute",(function(){return c.d}));var u=n(28);for(var s in u)["default","PARSE_ERROR","INVALID_REQUEST","METHOD_NOT_FOUND","INVALID_PARAMS","INTERNAL_ERROR","SERVER_ERROR","RESERVED_ERROR_CODES","SERVER_ERROR_CODE_RANGE","STANDARD_ERROR_MAP","DEFAULT_ERROR","isServerErrorCode","isReservedErrorCode","isValidErrorCode","getError","getErrorByCode","validateJsonRpcError","parseConnectionError","payloadId","formatJsonRpcRequest","formatJsonRpcResult","formatJsonRpcError","formatErrorMessage","isValidRoute","isValidDefaultRoute","isValidWildcardRoute","isValidLeadingWildcardRoute","isValidTrailingWildcardRoute"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return u[e]}))}(s);var l=n(32);n.d(t,"isHttpUrl",(function(){return l.a})),n.d(t,"isWsUrl",(function(){return l.c})),n.d(t,"isLocalhostUrl",(function(){return l.b}));var f=n(33);n.d(t,"isJsonRpcPayload",(function(){return f.b})),n.d(t,"isJsonRpcRequest",(function(){return f.c})),n.d(t,"isJsonRpcResponse",(function(){return f.d})),n.d(t,"isJsonRpcResult",(function(){return f.e})),n.d(t,"isJsonRpcError",(function(){return f.a})),n.d(t,"isJsonRpcValidationInvalid",(function(){return f.f}))},function(e,t,n){n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return a})),n.d(t,"c",(function(){return c})),n.d(t,"d",(function(){return u})),n.d(t,"e",(function(){return l})),n.d(t,"f",(function(){return f}));var r=n(5),i=n(3);async function o(e,t=i.a){return r.getSubtleCrypto().importKey("raw",e,function(e){return e===i.a?{length:i.b,name:i.a}:{hash:{name:i.f},name:i.e}}(t),!0,function(e){return e===i.a?[i.d,i.c]:[i.k,i.l]}(t))}async function s(e,t,n){const s=r.getSubtleCrypto(),a=await o(t,i.a),c=await s.encrypt({iv:e,name:i.a},a,n);return new Uint8Array(c)}async function a(e,t,n){const s=r.getSubtleCrypto(),a=await o(t,i.a),c=await s.decrypt({iv:e,name:i.a},a,n);return new Uint8Array(c)}async function c(e,t){const n=r.getSubtleCrypto(),s=await o(e,i.e),a=await n.sign({length:i.g,name:i.e},s,t);return new Uint8Array(a)}async function u(e,t){const n=r.getSubtleCrypto(),s=await o(e,i.e),a=await n.sign({length:i.h,name:i.e},s,t);return new Uint8Array(a)}async function l(e){const t=r.getSubtleCrypto(),n=await t.digest({name:i.i},e);return new Uint8Array(n)}async function f(e){const t=r.getSubtleCrypto(),n=await t.digest({name:i.j},e);return new Uint8Array(n)}},function(e,t){let n;const r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];t.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return r[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');n=e},t.isKanjiModeEnabled=function(){return void 0!==n},t.toSJIS=function(e){return n(e)}},function(e,t,n){const r=n(54),i=n(55);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!r.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return i.testNumeric(e)?t.NUMERIC:i.testAlphanumeric(e)?t.ALPHANUMERIC:i.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(e){return n}}},function(e,t,n){n.d(t,"d",(function(){return i})),n.d(t,"c",(function(){return o})),n.d(t,"e",(function(){return s})),n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return c})),n.d(t,"g",(function(){return u})),n.d(t,"f",(function(){return l}));var r=n(4);function i(e){return e<=r.i[0]&&e>=r.i[1]}function o(e){return r.g.includes(e)}function s(e){return"number"==typeof e}function a(e){return Object.keys(r.j).includes(e)?r.j[e]:r.j[r.a]}function c(e){return Object.values(r.j).find((t=>t.code===e))||r.j[r.a]}function u(e){if(void 0===e.error.code)return{valid:!1,error:"Missing code for JSON-RPC error"};if(void 0===e.error.message)return{valid:!1,error:"Missing message for JSON-RPC error"};if(!s(e.error.code))return{valid:!1,error:"Invalid error code type for JSON-RPC: "+e.error.code};if(o(e.error.code)){const t=c(e.error.code);if(t.message!==r.j[r.a].message&&e.error.message===t.message)return{valid:!1,error:"Invalid error code message for JSON-RPC: "+e.error.code}}return{valid:!0}}function l(e,t,n){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${t}`):e}},function(e,t,n){function r(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSON.parse(e)}catch(t){return e}}function i(e){return"string"==typeof e?e:JSON.stringify(e)}n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i}))},function(e,t,n){var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,i)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function f(e,t,n,r){var i,o,s,a;if(u(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=l(e))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)o(c,this,t);else{var u=c.length,l=y(c,u);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){var r=n(45);n.d(t,"randomBytes",(function(){return r.a}));var i=n(46);n.d(t,"aesCbcDecrypt",(function(){return i.a})),n.d(t,"aesCbcEncrypt",(function(){return i.b}));var o=n(47);n.d(t,"hmacSha256Sign",(function(){return o.a})),n(52),n(16),n(3)},function(e,t,n){n.d(t,"a",(function(){return r}));class r{}},function(e,t,n){var r=n(48);n.o(r,"isConstantTime")&&n.d(t,"isConstantTime",(function(){return r.isConstantTime})),n(49);var i=n(50);n.o(i,"isConstantTime")&&n.d(t,"isConstantTime",(function(){return i.isConstantTime}));var o=n(51);n.d(t,"isConstantTime",(function(){return o.a}))},function(e,t,n){n.r(t),n.d(t,"__extends",(function(){return i})),n.d(t,"__assign",(function(){return o})),n.d(t,"__rest",(function(){return s})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return c})),n.d(t,"__metadata",(function(){return u})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return f})),n.d(t,"__createBinding",(function(){return h})),n.d(t,"__exportStar",(function(){return d})),n.d(t,"__values",(function(){return p})),n.d(t,"__read",(function(){return g})),n.d(t,"__spread",(function(){return y})),n.d(t,"__spreadArrays",(function(){return m})),n.d(t,"__await",(function(){return v})),n.d(t,"__asyncGenerator",(function(){return _})),n.d(t,"__asyncDelegator",(function(){return b})),n.d(t,"__asyncValues",(function(){return w})),n.d(t,"__makeTemplateObject",(function(){return E})),n.d(t,"__importStar",(function(){return S})),n.d(t,"__importDefault",(function(){return O})),n.d(t,"__classPrivateFieldGet",(function(){return R})),n.d(t,"__classPrivateFieldSet",(function(){return I}));var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function c(e,t){return function(n,r){t(n,r,e)}}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function y(){for(var e=[],t=0;t1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof v?Promise.resolve(n.value.v).then(c,u):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function b(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:v(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function w(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){!function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}(r,i,(t=e[n](t)).done,t.value)}))}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function S(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function O(e){return e&&e.__esModule?e:{default:e}}function R(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function I(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,u=[],l=!1,f=-1;function h(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&d())}function d(){if(!l){var e=a(h);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f1)for(var n=1;n=0&&e.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(e){return n}}},function(e,t){e.exports=i,i.strict=o,i.loose=s;var n=Object.prototype.toString,r={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function i(e){return o(e)||s(e)}function o(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function s(e){return r[n.call(e)]}},function(e,t){var n="undefined"!=typeof self?self:this,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function f(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function d(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=d(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e,t,n,r=d(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,n=p(t=new FileReader),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function b(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function w(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},m.call(_.prototype),m.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];w.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function S(e,n){return new Promise((function(r,o){var s=new _(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e,t,n={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;r(new w(i,n))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}S.polyfill=!0,e.fetch||(e.fetch=S,e.Headers=h,e.Request=_,e.Response=w),t.Headers=h,t.Request=_,t.Response=w,t.fetch=S,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},function(e,t,n){const r=n(69),i=n(70),o=n(71),s=n(72);function a(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function c(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function u(e,t){return t.decode?i(e):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function f(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function h(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function d(e,t){a((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"==typeof n&&n.includes(e.arrayFormatSeparator),o="string"==typeof n&&!i&&u(n,e).includes(e.arrayFormatSeparator);n=o?u(n,e):n;const s=i||o?n.split(e.arrayFormatSeparator).map((t=>u(t,e))):null===n?n:u(n,e);r[t]=s};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const i of e.split("&")){if(""===i)continue;let[e,s]=o(t.decode?i.replace(/\+/g," "):i,"=");s=void 0===s?null:["comma","separator"].includes(t.arrayFormat)?s:u(s,t),n(u(e,t),s,r)}for(const e of Object.keys(r)){const n=r[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=h(n[e],t);else r[e]=h(n,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce(((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort(((e,t)=>Number(e)-Number(t))).map((e=>t[e])):t}(n):e[t]=n,e}),Object.create(null))}t.extract=f,t.parse=d,t.stringify=(e,t)=>{if(!e)return"";a((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n],r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[c(t,e),"[",i,"]"].join("")]:[...n,[c(t,e),"[",c(i,e),"]=",c(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[c(t,e),"[]"].join("")]:[...n,[c(t,e),"[]=",c(r,e)].join("")];case"comma":case"separator":return t=>(n,r)=>null==r||0===r.length?n:0===n.length?[[c(t,e),"=",c(r,e)].join("")]:[[n,c(r,e)].join(e.arrayFormatSeparator)];default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,c(t,e)]:[...n,[c(t,e),"=",c(r,e)].join("")]}}(t),i={};for(const t of Object.keys(e))n(t)||(i[t]=e[t]);const o=Object.keys(i);return!1!==t.sort&&o.sort(t.sort),o.map((n=>{const i=e[n];return void 0===i?"":null===i?c(n,t):Array.isArray(i)?i.reduce(r(n),[]).join("&"):c(n,t)+"="+c(i,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,r]=o(e,"#");return Object.assign({url:n.split("?")[0]||"",query:d(f(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:u(r,t)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0},n);const r=l(e.url).split("?")[0]||"",i=t.extract(e.url),o=t.parse(i,{sort:!1}),s=Object.assign(o,e.query);let a=t.stringify(s,n);a&&(a="?"+a);let u=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url);return e.fragmentIdentifier&&(u="#"+c(e.fragmentIdentifier,n)),`${r}${a}${u}`},t.pick=(e,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0},r);const{url:i,query:o,fragmentIdentifier:a}=t.parseUrl(e,r);return t.stringifyUrl({url:i,query:s(o,n),fragmentIdentifier:a},r)},t.exclude=(e,n,r)=>{const i=Array.isArray(n)?e=>!n.includes(e):(e,t)=>!n(e,t);return t.pick(e,i,r)}},function(e,t,n){n.r(t),n.d(t,"isNodeJs",(function(){return o}));var r=n(5);for(var i in r)["default","isNodeJs"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(i);const o=r.isNode},function(e,t,n){n.d(t,"e",(function(){return o})),n.d(t,"c",(function(){return s})),n.d(t,"d",(function(){return a})),n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return u}));var r=n(11),i=n(4);function o(){return Date.now()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))}function s(e,t,n){return{id:n||o(),jsonrpc:"2.0",method:e,params:t}}function a(e,t){return{id:e,jsonrpc:"2.0",result:t}}function c(e,t,n){return{id:e,jsonrpc:"2.0",error:u(t,n)}}function u(e,t){return void 0===e?Object(r.a)(i.b):("string"==typeof e&&(e=Object.assign(Object.assign({},Object(r.a)(i.h)),{message:e})),void 0!==t&&(e.data=t),Object(r.c)(e.code)&&(e=Object(r.b)(e.code)),e)}},function(e,t,n){function r(e){return e.includes("*")?o(e):!/\W/g.test(e)}function i(e){return"*"===e}function o(e){return!!i(e)||!!e.includes("*")&&2===e.split("*").length&&1===e.split("*").filter((e=>""===e.trim())).length}function s(e){return!i(e)&&o(e)&&!e.split("*")[0].trim()}function a(e){return!i(e)&&o(e)&&!e.split("*")[1].trim()}n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){return i})),n.d(t,"e",(function(){return o})),n.d(t,"b",(function(){return s})),n.d(t,"d",(function(){return a}))},function(e,t,n){n.r(t);var r=n(20);for(var i in r)["default"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(i)},function(e,t){},function(e,t,n){n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return o})),n.d(t,"c",(function(){return s}));var r=n(15);class i extends r.a{constructor(e){super()}}class o extends r.a{constructor(){super()}}class s extends o{constructor(e){super()}}},function(e,t){},function(e,t,n){function r(e,t){const n=function(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return void 0!==n&&new RegExp(t).test(n)}function i(e){return r(e,"^https?:")}function o(e){return r(e,"^wss?:")}function s(e){return new RegExp("wss?://localhost(:d{2,5})?").test(e)}n.d(t,"a",(function(){return i})),n.d(t,"c",(function(){return o})),n.d(t,"b",(function(){return s}))},function(e,t,n){function r(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function i(e){return r(e)&&"method"in e}function o(e){return r(e)&&(s(e)||a(e))}function s(e){return"result"in e}function a(e){return"error"in e}function c(e){return"error"in e&&!1===e.valid}n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return o})),n.d(t,"e",(function(){return s})),n.d(t,"a",(function(){return a})),n.d(t,"f",(function(){return c}))},function(e,t){},function(e,t){},function(e,t,n){n.d(t,"a",(function(){return r}));class r{}},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){(function(e){var r=n(66),i=n(67),o=n(68);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(r)return B(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return x(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return R(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,i){if(0===e.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:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){for(var f=!0,h=0;hi&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function R(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+f<=n)switch(f){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function A(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function T(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function M(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,r,o){return o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function j(e,t,n,r,o){return o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return u(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,r){return l(t),t<=0?a(e,t):void 0!==n?"string"==typeof r?a(e,t).fill(n,r):a(e,t).fill(n):a(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return f(null,e)},c.allocUnsafeSlow=function(e){return f(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},c.prototype.compare=function(e,t,n,r,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n),f=0;fi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return _(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUInt8=function(e,t){return t||N(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||N(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||N(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||N(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||N(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||N(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||N(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||N(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||N(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||N(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||N(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||A(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):T(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);A(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):T(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return j(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return j(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=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),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=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((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function H(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(18))},function(e,t,n){n.d(t,"a",(function(){return i}));var r=n(5);function i(e){return r.getBrowerCrypto().getRandomValues(new Uint8Array(e))}},function(e,t,n){n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return o}));var r=n(8);function i(e,t,n){return Object(r.b)(e,t,n)}function o(e,t,n){return Object(r.a)(e,t,n)}},function(e,t,n){n.d(t,"a",(function(){return i}));var r=n(8);async function i(e,t){return await Object(r.c)(e,t)}n(16)},function(e,t,n){var r=n(5);n.o(r,"isConstantTime")&&n.d(t,"isConstantTime",(function(){return r.isConstantTime}))},function(e,t,n){},function(e,t){},function(e,t,n){function r(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r=1&&e<=40}},function(e,t){let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+")(?:.|[\r\n]))+";t.KANJI=new RegExp(n,"g"),t.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=new RegExp(r,"g"),t.NUMERIC=new RegExp("[0-9]+","g"),t.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const i=new RegExp("^"+n+"$"),o=new RegExp("^[0-9]+$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return i.test(e)},t.testNumeric=function(e){return o.test(e)},t.testAlphanumeric=function(e){return s.test(e)}},function(e,t){function n(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});const t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:t,color:{dark:n(e.color.dark||"#000000ff"),light:n(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,n){const r=t.getScale(e,n);return Math.floor((e+2*n.margin)*r)},t.qrToImageData=function(e,n,r){const i=n.modules.size,o=n.modules.data,s=t.getScale(i,r),a=Math.floor((i+2*r.margin)*s),c=r.margin*s,u=[r.color.light,r.color.dark];for(let t=0;t=c&&n>=c&&tr.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(i.length&&i){const e=r.getAttribute("content");if(e)return e}}return""}const i=function(){let t=n("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:n("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const n=e.getElementsByTagName("link"),r=[];for(let e=0;e-1){const e=i.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let n=t.protocol+"//"+t.host;if(0===e.indexOf("/"))n+=e;else{const r=t.pathname.split("/");r.pop(),n+=r.join("/")+"/"+e}r.push(n)}else if(0===e.indexOf("//")){const n=t.protocol+e;r.push(n)}else r.push(e)}}return r}(),name:i}}},function(e,t,n){(function(e){var r=n(1),i=n(62);const o=void 0!==e.WebSocket?e.WebSocket:n(74);t.a=class{constructor(e){if(this.opts=e,this._queue=[],this._events=[],this._subscriptions=[],this._protocol=e.protocol,this._version=e.version,this._url="",this._netMonitor=null,this._socket=null,this._nextSocket=null,this._subscriptions=e.subscriptions||[],this._netMonitor=e.netMonitor||new i.a,!e.url||"string"!=typeof e.url)throw new Error("Missing or invalid WebSocket url");this._url=e.url,this._netMonitor.on("online",(()=>this._socketCreate()))}set readyState(e){}get readyState(){return this._socket?this._socket.readyState:-1}set connecting(e){}get connecting(){return 0===this.readyState}set connected(e){}get connected(){return 1===this.readyState}set closing(e){}get closing(){return 2===this.readyState}set closed(e){}get closed(){return 3===this.readyState}open(){this._socketCreate()}close(){this._socketClose()}send(e,t,n){if(!t||"string"!=typeof t)throw new Error("Missing or invalid topic field");this._socketSend({topic:t,type:"pub",payload:e,silent:!!n})}subscribe(e){this._socketSend({topic:e,type:"sub",payload:"",silent:!0})}on(e,t){this._events.push({event:e,callback:t})}_socketCreate(){if(this._nextSocket)return;const e=function(e,t,n){var i,o;const s=(e.startsWith("https")?e.replace("https","wss"):e.startsWith("http")?e.replace("http","ws"):e).split("?"),a=Object(r.isBrowser)()?{protocol:t,version:n,env:"browser",host:(null===(i=Object(r.getLocation)())||void 0===i?void 0:i.host)||""}:{protocol:t,version:n,env:(null===(o=Object(r.detectEnv)())||void 0===o?void 0:o.name)||""},c=Object(r.appendToQueryString)(Object(r.getQueryString)(s[1]||""),a);return s[0]+"?"+c}(this._url,this._protocol,this._version);if(this._nextSocket=new o(e),!this._nextSocket)throw new Error("Failed to create socket");this._nextSocket.onmessage=e=>this._socketReceive(e),this._nextSocket.onopen=()=>this._socketOpen(),this._nextSocket.onerror=e=>this._socketError(e),this._nextSocket.onclose=()=>{setTimeout((()=>{this._nextSocket=null,this._socketCreate()}),1e3)}}_socketOpen(){this._socketClose(),this._socket=this._nextSocket,this._nextSocket=null,this._queueSubscriptions(),this._pushQueue()}_socketClose(){this._socket&&(this._socket.onclose=()=>{},this._socket.close())}_socketSend(e){const t=JSON.stringify(e);this._socket&&1===this._socket.readyState?this._socket.send(t):(this._setToQueue(e),this._socketCreate())}async _socketReceive(e){let t;try{t=JSON.parse(e.data)}catch(e){return}if(this._socketSend({topic:t.topic,type:"ack",payload:"",silent:!0}),this._socket&&1===this._socket.readyState){const e=this._events.filter((e=>"message"===e.event));e&&e.length&&e.forEach((e=>e.callback(t)))}}_socketError(e){const t=this._events.filter((e=>"error"===e.event));t&&t.length&&t.forEach((t=>t.callback(e)))}_queueSubscriptions(){this._subscriptions.forEach((e=>this._queue.push({topic:e,type:"sub",payload:"",silent:!0}))),this._subscriptions=this.opts.subscriptions||[]}_setToQueue(e){this._queue.push(e)}_pushQueue(){this._queue.forEach((e=>this._socketSend(e))),this._queue=[]}}}).call(this,n(18))},function(e,t,n){t.a=class{constructor(){this._eventEmitters=[],"undefined"!=typeof window&&void 0!==window.addEventListener&&(window.addEventListener("online",(()=>this.trigger("online"))),window.addEventListener("offline",(()=>this.trigger("offline"))))}on(e,t){this._eventEmitters.push({event:e,callback:t})}trigger(e){let t=[];e&&(t=this._eventEmitters.filter((t=>t.event===e))),t.forEach((e=>{e.callback()}))}}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});const r=n(17),i=r.__importDefault(n(13)),o=n(102),s=n(103),a=n(2),c=n(1),u=n(73);t.default=class{constructor(e){this.events=new i.default,this.rpc={infuraId:null==e?void 0:e.infuraId,custom:null==e?void 0:e.rpc},this.signer=new o.JsonRpcProvider(new u.SignerConnection(e));const t=this.signer.connection.chainId||(null==e?void 0:e.chainId)||1;this.http=this.setHttpProvider(t),this.registerEventListeners()}get connected(){return this.signer.connection.connected}get connector(){return this.signer.connection.connector}get accounts(){return this.signer.connection.accounts}get chainId(){return this.signer.connection.chainId}get rpcUrl(){var e;return(null===(e=this.http)||void 0===e?void 0:e.connection).url||""}request(e){return r.__awaiter(this,void 0,void 0,(function*(){switch(e.method){case"eth_requestAccounts":return yield this.connect(),this.signer.connection.accounts;case"eth_accounts":return this.signer.connection.accounts;case"eth_chainId":return this.signer.connection.chainId}if(a.SIGNING_METHODS.includes(e.method))return this.signer.request(e);if(void 0===this.http)throw new Error(`Cannot request JSON-RPC method (${e.method}) without provided rpc url`);return this.http.request(e)}))}sendAsync(e,t){this.request(e).then((e=>t(null,e))).catch((e=>t(e,void 0)))}enable(){return r.__awaiter(this,void 0,void 0,(function*(){return yield this.request({method:"eth_requestAccounts"})}))}connect(){return r.__awaiter(this,void 0,void 0,(function*(){this.signer.connection.connected||(yield this.signer.connect())}))}disconnect(){return r.__awaiter(this,void 0,void 0,(function*(){this.signer.connection.connected&&(yield this.signer.disconnect())}))}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}registerEventListeners(){this.signer.connection.on("accountsChanged",(e=>{this.events.emit("accountsChanged",e)})),this.signer.connection.on("chainChanged",(e=>{this.http=this.setHttpProvider(e),this.events.emit("chainChanged",e)})),this.signer.on("disconnect",(()=>{this.events.emit("disconnect")}))}setHttpProvider(e){const t=c.getRpcUrl(e,this.rpc);if(void 0!==t)return new o.JsonRpcProvider(new s.HttpConnection(t))}}},function(e,t,n){(function(e){function n(){return(null==e?void 0:e.crypto)||(null==e?void 0:e.msCrypto)||{}}function r(){const e=n();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=n,t.getSubtleCrypto=r,t.isBrowserCryptoAvailable=function(){return!!n()&&!!r()}}).call(this,n(18))},function(e,t,n){(function(e){function n(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function r(){return void 0!==e&&void 0!==e.versions&&void 0!==e.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=n,t.isNode=r,t.isBrowser=function(){return!n()&&!r()}}).call(this,n(19))},function(e,t,n){t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),s=r[0],a=r[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,f=a>0?s-4:s;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,u[l++]=255&t),1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;sa?a:s+16383));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e,t,n){for(var i,o,s=[],a=t;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,c=(1<>1,l=-7,f=n?i-1:0,h=n?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=u}return(d?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,c,u=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?h/c:h*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;e[n+d]=255&s,d+=p,s/=256,u-=8);e[n+d-p]|=128*g}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>"%"+e.charCodeAt(0).toString(16).toUpperCase()))},function(e,t,n){var r=new RegExp("(%[a-f0-9]{2})|([^%]+?)","gi"),i=new RegExp("(%[a-f0-9]{2})+","gi");function o(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],o(n),o(r))}function s(e){try{return decodeURIComponent(e)}catch(i){for(var t=e.match(r)||[],n=1;n{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]}},function(e,t,n){e.exports=function(e,t){for(var n={},r=Object.keys(e),i=Array.isArray(t),o=0;o{this.on("error",(e=>{n(e)})),this.on("open",(()=>{t()})),this.create(e)}));this.onOpen()}))}close(){return r.__awaiter(this,void 0,void 0,(function*(){void 0!==this.wc&&(this.wc.connected&&this.wc.killSession(),this.onClose())}))}send(e){return r.__awaiter(this,void 0,void 0,(function*(){this.wc=this.register(this.opts),this.connected||(yield this.open()),this.sendPayload(e).then((e=>this.events.emit("payload",e))).catch((t=>this.events.emit("payload",c.formatJsonRpcError(e.id,t.message))))}))}register(e){if(this.wc)return this.wc;this.opts=e||this.opts,this.bridge=(null==e?void 0:e.connector)?e.connector.bridge:(null==e?void 0:e.bridge)||"https://bridge.walletconnect.org",this.qrcode=void 0===(null==e?void 0:e.qrcode)||!1!==e.qrcode,this.chainId=void 0!==(null==e?void 0:e.chainId)?e.chainId:this.chainId,this.qrcodeModalOptions=null==e?void 0:e.qrcodeModalOptions;const t={bridge:this.bridge,qrcodeModal:this.qrcode?s.default:void 0,qrcodeModalOptions:this.qrcodeModalOptions,storageId:null==e?void 0:e.storageId,signingMethods:null==e?void 0:e.signingMethods,clientMeta:null==e?void 0:e.clientMeta};if(this.wc=void 0!==(null==e?void 0:e.connector)?e.connector:new o.default(t),void 0===this.wc)throw new Error("Failed to register WalletConnect connector");return this.wc.accounts.length&&(this.accounts=this.wc.accounts),this.wc.chainId&&(this.chainId=this.wc.chainId),this.registerConnectorEvents(),this.wc}onOpen(e){this.pending=!1,e&&(this.wc=e),this.events.emit("open")}onClose(){this.pending=!1,this.wc&&(this.wc=void 0),this.events.emit("close")}onError(e,t="Failed or Rejected Request",n=-32e3){const r={id:e.id,jsonrpc:e.jsonrpc,error:{code:n,message:t}};return this.events.emit("payload",r),r}create(e){this.wc=this.register(this.opts),this.chainId=e||this.chainId,this.connected||this.pending||(this.pending=!0,this.registerConnectorEvents(),this.wc.createSession({chainId:this.chainId}).then((()=>this.events.emit("created"))).catch((e=>this.events.emit("error",e))))}registerConnectorEvents(){this.wc=this.register(this.opts),this.wc.on("connect",(e=>{var t,n;e?this.events.emit("error",e):(this.accounts=(null===(t=this.wc)||void 0===t?void 0:t.accounts)||[],this.chainId=(null===(n=this.wc)||void 0===n?void 0:n.chainId)||this.chainId,this.onOpen())})),this.wc.on("disconnect",(e=>{e?this.events.emit("error",e):this.onClose()})),this.wc.on("modal_closed",(()=>{this.events.emit("error",new Error("User closed modal"))})),this.wc.on("session_update",((e,t)=>{const{accounts:n,chainId:r}=t.params[0];(!this.accounts||n&&this.accounts!==n)&&(this.accounts=n,this.events.emit("accountsChanged",n)),(!this.chainId||r&&this.chainId!==r)&&(this.chainId=r,this.events.emit("chainChanged",r))}))}sendPayload(e){return r.__awaiter(this,void 0,void 0,(function*(){this.wc=this.register(this.opts);try{const t=yield this.wc.unsafeSend(e);return this.sanitizeResponse(t)}catch(t){return this.onError(e,t.message)}}))}sanitizeResponse(e){return void 0!==e.error&&void 0===e.error.code?c.formatJsonRpcError(e.id,e.error.message,e.error.data):e}}t.SignerConnection=u,t.default=u},function(e,t,n){e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},function(e,t,n){(function(t){function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var i=n(1),o=r(n(76)),s=r(n(98)),a=n(101);function c(e){return a.createElement("div",{className:"walletconnect-modal__header"},a.createElement("img",{src:"data:image/svg+xml,%3C?xml version='1.0' encoding='UTF-8'?%3E %3Csvg width='300px' height='185px' viewBox='0 0 300 185' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E %3C!-- Generator: Sketch 49.3 (51167) - http://www.bohemiancoding.com/sketch --%3E %3Ctitle%3EWalletConnect%3C/title%3E %3Cdesc%3ECreated with Sketch.%3C/desc%3E %3Cdefs%3E%3C/defs%3E %3Cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E %3Cg id='walletconnect-logo-alt' fill='%233B99FC' fill-rule='nonzero'%3E %3Cpath d='M61.4385429,36.2562612 C110.349767,-11.6319051 189.65053,-11.6319051 238.561752,36.2562612 L244.448297,42.0196786 C246.893858,44.4140867 246.893858,48.2961898 244.448297,50.690599 L224.311602,70.406102 C223.088821,71.6033071 221.106302,71.6033071 219.883521,70.406102 L211.782937,62.4749541 C177.661245,29.0669724 122.339051,29.0669724 88.2173582,62.4749541 L79.542302,70.9685592 C78.3195204,72.1657633 76.337001,72.1657633 75.1142214,70.9685592 L54.9775265,51.2530561 C52.5319653,48.8586469 52.5319653,44.9765439 54.9775265,42.5821357 L61.4385429,36.2562612 Z M280.206339,77.0300061 L298.128036,94.5769031 C300.573585,96.9713 300.573599,100.85338 298.128067,103.247793 L217.317896,182.368927 C214.872352,184.763353 210.907314,184.76338 208.461736,182.368989 C208.461726,182.368979 208.461714,182.368967 208.461704,182.368957 L151.107561,126.214385 C150.496171,125.615783 149.504911,125.615783 148.893521,126.214385 C148.893517,126.214389 148.893514,126.214393 148.89351,126.214396 L91.5405888,182.368927 C89.095052,184.763359 85.1300133,184.763399 82.6844276,182.369014 C82.6844133,182.369 82.684398,182.368986 82.6843827,182.36897 L1.87196327,103.246785 C-0.573596939,100.852377 -0.573596939,96.9702735 1.87196327,94.5758653 L19.7936929,77.028998 C22.2392531,74.6345898 26.2042918,74.6345898 28.6498531,77.028998 L86.0048306,133.184355 C86.6162214,133.782957 87.6074796,133.782957 88.2188704,133.184355 C88.2188796,133.184346 88.2188878,133.184338 88.2188969,133.184331 L145.571,77.028998 C148.016505,74.6345347 151.981544,74.6344449 154.427161,77.028798 C154.427195,77.0288316 154.427229,77.0288653 154.427262,77.028899 L211.782164,133.184331 C212.393554,133.782932 213.384814,133.782932 213.996204,133.184331 L271.350179,77.0300061 C273.79574,74.6355969 277.760778,74.6355969 280.206339,77.0300061 Z' id='WalletConnect'%3E%3C/path%3E %3C/g%3E %3C/g%3E %3C/svg%3E",className:"walletconnect-modal__headerLogo"}),a.createElement("p",null,"WalletConnect"),a.createElement("div",{className:"walletconnect-modal__close__wrapper",onClick:e.onClose},a.createElement("div",{id:"walletconnect-qrcode-close",className:"walletconnect-modal__close__icon"},a.createElement("div",{className:"walletconnect-modal__close__line1"}),a.createElement("div",{className:"walletconnect-modal__close__line2"}))))}function u(e){return a.createElement("a",{className:"walletconnect-connect__button",href:e.href,id:"walletconnect-connect-button-"+e.name,onClick:e.onClick,rel:"noopener noreferrer",style:{backgroundColor:e.color},target:"_blank"},e.name)}function l(e){var t=e.color,n=e.href,r=e.name,i=e.logo,o=e.onClick;return a.createElement("a",{className:"walletconnect-modal__base__row",href:n,onClick:o,rel:"noopener noreferrer",target:"_blank"},a.createElement("h3",{className:"walletconnect-modal__base__row__h3"},r),a.createElement("div",{className:"walletconnect-modal__base__row__right"},a.createElement("div",{className:"walletconnect-modal__base__row__right__app-icon",style:{background:"url('"+i+"') "+t,backgroundSize:"100%"}}),a.createElement("img",{src:"data:image/svg+xml,%3Csvg width='8' height='18' viewBox='0 0 8 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M0.586301 0.213898C0.150354 0.552968 0.0718197 1.18124 0.41089 1.61719L5.2892 7.88931C5.57007 8.25042 5.57007 8.75608 5.2892 9.11719L0.410889 15.3893C0.071819 15.8253 0.150353 16.4535 0.586301 16.7926C1.02225 17.1317 1.65052 17.0531 1.98959 16.6172L6.86791 10.3451C7.7105 9.26174 7.7105 7.74476 6.86791 6.66143L1.98959 0.38931C1.65052 -0.0466374 1.02225 -0.125172 0.586301 0.213898Z' fill='%233C4252'/%3E %3C/svg%3E",className:"walletconnect-modal__base__row__right__caret"})))}function f(e){var t=e.color,n=e.href,r=e.name,i=e.logo,o=e.onClick,s=window.innerWidth<768?(r.length>8?2.5:2.7)+"vw":"inherit";return a.createElement("a",{className:"walletconnect-connect__button__icon_anchor",href:n,onClick:o,rel:"noopener noreferrer",target:"_blank"},a.createElement("div",{className:"walletconnect-connect__button__icon",style:{background:"url('"+i+"') "+t,backgroundSize:"100%"}}),a.createElement("div",{style:{fontSize:s},className:"walletconnect-connect__button__text"},r))}function h(e){var t=i.isAndroid(),n=a.useState(""),r=n[0],o=n[1],s=a.useState(""),c=s[0],h=s[1],d=a.useState(1),p=d[0],g=d[1],y=c?e.links.filter((function(e){return e.name.toLowerCase().includes(c.toLowerCase())})):e.links,m=e.errorMessage,v=c||y.length>5,_=Math.ceil(y.length/12),b=[12*(p-1)+1,12*p],w=y.length?y.filter((function(e,t){return t+1>=b[0]&&t+1<=b[1]})):[],E=!(t||!(_>1)),S=void 0;return a.createElement("div",null,a.createElement("p",{id:"walletconnect-qrcode-text",className:"walletconnect-qrcode__text"},t?e.text.connect_mobile_wallet:e.text.choose_preferred_wallet),!t&&a.createElement("input",{className:"walletconnect-search__input",placeholder:"Search",value:r,onChange:function(e){o(e.target.value),clearTimeout(S),e.target.value?S=setTimeout((function(){h(e.target.value),g(1)}),1e3):(o(""),h(""),g(1))}}),a.createElement("div",{className:"walletconnect-connect__buttons__wrapper"+(t?"__android":v&&y.length?"__wrap":"")},t?a.createElement(u,{name:e.text.connect,color:"rgb(64, 153, 255)",href:e.uri,onClick:a.useCallback((function(){i.saveMobileLinkInfo({name:"Unknown",href:e.uri})}),[])}):w.length?w.map((function(t){var n=t.color,r=t.name,o=t.shortName,s=t.logo,c=i.formatIOSMobile(e.uri,t),u=a.useCallback((function(){i.saveMobileLinkInfo({name:r,href:c})}),[w]);return v?a.createElement(f,{color:n,href:c,name:o||r,logo:s,onClick:u}):a.createElement(l,{color:n,href:c,name:r,logo:s,onClick:u})})):a.createElement(a.Fragment,null,a.createElement("p",null,m.length?e.errorMessage:e.links.length&&!y.length?e.text.no_wallets_found:e.text.loading))),E&&a.createElement("div",{className:"walletconnect-modal__footer"},Array(_).fill(0).map((function(e,t){var n=t+1,r=p===n;return a.createElement("a",{style:{margin:"auto 10px",fontWeight:r?"bold":"normal"},onClick:function(){return g(n)}},n)}))))}function d(e){var t=!!e.message.trim();return a.createElement("div",{className:"walletconnect-qrcode__notification"+(t?" notification__show":"")},e.message)}function p(e){var t=a.useState(""),n=t[0],r=t[1],i=a.useState(""),c=i[0],u=i[1];return a.useEffect((function(){try{return Promise.resolve(function(e){try{var t="";return Promise.resolve(o.toString(e,{margin:0,type:"svg"})).then((function(e){return"string"==typeof e&&(t=e.replace("0||a.useEffect((function(){!function(){try{if(t)return Promise.resolve();u(!0);var o=function(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}((function(){var t=e.qrcodeModalOptions&&e.qrcodeModalOptions.registryUrl?e.qrcodeModalOptions.registryUrl:i.getWalletRegistryUrl();return Promise.resolve(fetch(t)).then((function(t){return Promise.resolve(t.json()).then((function(t){var o=t.listings,s=n?"mobile":"desktop",a=i.getMobileLinkRegistry(i.formatMobileRegistry(o,s),r);u(!1),d(!0),k(a.length?"":e.text.no_supported_wallets),x(a);var c=1===a.length;c&&(w(i.formatIOSMobile(e.uri,a[0])),m(!0)),O(c)}))}))}),(function(t){u(!1),d(!0),k(e.text.something_went_wrong),console.error(t)}));Promise.resolve(o&&o.then?o.then((function(){})):void 0)}catch(e){return Promise.reject(e)}}()}))};N();var A=n?y:!y;return a.createElement("div",{id:"walletconnect-qrcode-modal",className:"walletconnect-qrcode__base animated fadeIn"},a.createElement("div",{className:"walletconnect-modal__base"},a.createElement(c,{onClose:e.onClose}),S&&y?a.createElement("div",{className:"walletconnect-modal__single_wallet"},a.createElement("a",{onClick:function(){return i.saveMobileLinkInfo({name:I[0].name,href:b})},href:b,rel:"noopener noreferrer",target:"_blank"},e.text.connect_with+" "+(S?I[0].name:"")+" ›")):t||s||!s&&I.length?a.createElement("div",{className:"walletconnect-modal__mobile__toggle"+(A?" right__selected":"")},a.createElement("div",{className:"walletconnect-modal__mobile__toggle_selector"}),n?a.createElement(a.Fragment,null,a.createElement("a",{onClick:function(){return m(!1),N()}},e.text.mobile),a.createElement("a",{onClick:function(){return m(!0)}},e.text.qrcode)):a.createElement(a.Fragment,null,a.createElement("a",{onClick:function(){return m(!0)}},e.text.qrcode),a.createElement("a",{onClick:function(){return m(!1),N()}},e.text.desktop))):null,a.createElement("div",null,y||!t&&!s&&!I.length?a.createElement(p,Object.assign({},v)):a.createElement(h,Object.assign({},v,{links:I,errorMessage:P})))))}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var y={de:{choose_preferred_wallet:"Wähle bevorzugte Wallet",connect_mobile_wallet:"Verbinde mit Mobile Wallet",scan_qrcode_with_wallet:"Scanne den QR-code mit einer WalletConnect kompatiblen Wallet",connect:"Verbinden",qrcode:"QR-Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"In die Zwischenablage kopieren",copied_to_clipboard:"In die Zwischenablage kopiert!",connect_with:"Verbinden mit Hilfe von",loading:"Laden...",something_went_wrong:"Etwas ist schief gelaufen",no_supported_wallets:"Es gibt noch keine unterstützten Wallet",no_wallets_found:"keine Wallet gefunden"},en:{choose_preferred_wallet:"Choose your preferred wallet",connect_mobile_wallet:"Connect to Mobile Wallet",scan_qrcode_with_wallet:"Scan QR code with a WalletConnect-compatible wallet",connect:"Connect",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copy to clipboard",copied_to_clipboard:"Copied to clipboard!",connect_with:"Connect with",loading:"Loading...",something_went_wrong:"Something went wrong",no_supported_wallets:"There are no supported wallets yet",no_wallets_found:"No wallets found"},es:{choose_preferred_wallet:"Elige tu billetera preferida",connect_mobile_wallet:"Conectar a billetera móvil",scan_qrcode_with_wallet:"Escanea el código QR con una billetera compatible con WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvil",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Conectar mediante",loading:"Cargando...",something_went_wrong:"Algo salió mal",no_supported_wallets:"Todavía no hay billeteras compatibles",no_wallets_found:"No se encontraron billeteras"},fr:{choose_preferred_wallet:"Choisissez votre portefeuille préféré",connect_mobile_wallet:"Se connecter au portefeuille mobile",scan_qrcode_with_wallet:"Scannez le QR code avec un portefeuille compatible WalletConnect",connect:"Se connecter",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copier",copied_to_clipboard:"Copié!",connect_with:"Connectez-vous à l'aide de",loading:"Chargement...",something_went_wrong:"Quelque chose a mal tourné",no_supported_wallets:"Il n'y a pas encore de portefeuilles pris en charge",no_wallets_found:"Aucun portefeuille trouvé"},ko:{choose_preferred_wallet:"원하는 지갑을 선택하세요",connect_mobile_wallet:"모바일 지갑과 연결",scan_qrcode_with_wallet:"WalletConnect 지원 지갑에서 QR코드를 스캔하세요",connect:"연결",qrcode:"QR 코드",mobile:"모바일",desktop:"데스크탑",copy_to_clipboard:"클립보드에 복사",copied_to_clipboard:"클립보드에 복사되었습니다!",connect_with:"와 연결하다",loading:"로드 중...",something_went_wrong:"문제가 발생했습니다.",no_supported_wallets:"아직 지원되는 지갑이 없습니다",no_wallets_found:"지갑을 찾을 수 없습니다"},pt:{choose_preferred_wallet:"Escolha sua carteira preferida",connect_mobile_wallet:"Conectar-se à carteira móvel",scan_qrcode_with_wallet:"Ler o código QR com uma carteira compatível com WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvel",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Ligar por meio de",loading:"Carregamento...",something_went_wrong:"Algo correu mal",no_supported_wallets:"Ainda não há carteiras suportadas",no_wallets_found:"Nenhuma carteira encontrada"},zh:{choose_preferred_wallet:"选择你的钱包",connect_mobile_wallet:"连接至移动端钱包",scan_qrcode_with_wallet:"使用兼容 WalletConnect 的钱包扫描二维码",connect:"连接",qrcode:"二维码",mobile:"移动",desktop:"桌面",copy_to_clipboard:"复制到剪贴板",copied_to_clipboard:"复制到剪贴板成功!",connect_with:"通过以下方式连接",loading:"正在加载...",something_went_wrong:"出了问题",no_supported_wallets:"目前还没有支持的钱包",no_wallets_found:"没有找到钱包"},fa:{choose_preferred_wallet:"کیف پول مورد نظر خود را انتخاب کنید",connect_mobile_wallet:"به کیف پول موبایل وصل شوید",scan_qrcode_with_wallet:"کد QR را با یک کیف پول سازگار با WalletConnect اسکن کنید",connect:"اتصال",qrcode:"کد QR",mobile:"سیار",desktop:"دسکتاپ",copy_to_clipboard:"کپی به کلیپ بورد",copied_to_clipboard:"در کلیپ بورد کپی شد!",connect_with:"ارتباط با",loading:"...بارگذاری",something_went_wrong:"مشکلی پیش آمد",no_supported_wallets:"هنوز هیچ کیف پول پشتیبانی شده ای وجود ندارد",no_wallets_found:"هیچ کیف پولی پیدا نشد"}};function m(){var e=i.getDocumentOrThrow(),t=e.getElementById("walletconnect-qrcode-modal");t&&(t.className=t.className.replace("fadeIn","fadeOut"),setTimeout((function(){var t=e.getElementById("walletconnect-wrapper");t&&e.body.removeChild(t)}),300))}function v(e){return function(){m(),e&&e()}}var _=function(){return void 0!==t&&void 0!==t.versions&&void 0!==t.versions.node},b={open:function(e,t,n){console.log(e),_()?function(e){o.toString(e,{type:"terminal"}).then(console.log)}(e):function(e,t,n){!function(){var e=i.getDocumentOrThrow(),t=e.getElementById("walletconnect-style-sheet");t&&e.head.removeChild(t);var n=e.createElement("style");n.setAttribute("id","walletconnect-style-sheet"),n.innerText=':root {\n --animation-duration: 300ms;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n.animated {\n animation-duration: var(--animation-duration);\n animation-fill-mode: both;\n}\n\n.fadeIn {\n animation-name: fadeIn;\n}\n\n.fadeOut {\n animation-name: fadeOut;\n}\n\n#walletconnect-wrapper {\n -webkit-user-select: none;\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n left: 0;\n pointer-events: none;\n position: fixed;\n top: 0;\n user-select: none;\n width: 100%;\n z-index: 99999999999999;\n}\n\n.walletconnect-modal__headerLogo {\n height: 21px;\n}\n\n.walletconnect-modal__header p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n align-items: flex-start;\n display: flex;\n flex: 1;\n margin-left: 5px;\n}\n\n.walletconnect-modal__close__wrapper {\n position: absolute;\n top: 0px;\n right: 0px;\n z-index: 10000;\n background: white;\n border-radius: 26px;\n padding: 6px;\n box-sizing: border-box;\n width: 26px;\n height: 26px;\n cursor: pointer;\n}\n\n.walletconnect-modal__close__icon {\n position: relative;\n top: 7px;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(45deg);\n}\n\n.walletconnect-modal__close__line1 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n}\n\n.walletconnect-modal__close__line2 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n transform: rotate(90deg);\n}\n\n.walletconnect-qrcode__base {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n background: rgba(37, 41, 46, 0.95);\n height: 100%;\n left: 0;\n pointer-events: auto;\n position: fixed;\n top: 0;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n width: 100%;\n will-change: opacity;\n padding: 40px;\n box-sizing: border-box;\n}\n\n.walletconnect-qrcode__text {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 10px 0 20px 0;\n text-align: center;\n width: 100%;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-qrcode__text {\n font-size: 4vw;\n }\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-qrcode__text {\n font-size: 14px;\n }\n}\n\n.walletconnect-qrcode__image {\n width: calc(100% - 30px);\n box-sizing: border-box;\n cursor: none;\n margin: 0 auto;\n}\n\n.walletconnect-qrcode__notification {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n font-size: 16px;\n padding: 16px 20px;\n border-radius: 16px;\n text-align: center;\n transition: all 0.1s ease-in-out;\n background: white;\n color: black;\n margin-bottom: -60px;\n opacity: 0;\n}\n\n.walletconnect-qrcode__notification.notification__show {\n opacity: 1;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__header {\n height: 130px;\n }\n .walletconnect-modal__base {\n overflow: auto;\n }\n}\n\n@media only screen and (min-device-width: 415px) and (max-width: 768px) {\n #content {\n max-width: 768px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 375px) and (max-width: 415px) {\n #content {\n max-width: 414px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 320px) and (max-width: 375px) {\n #content {\n max-width: 375px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (max-width: 320px) {\n #content {\n max-width: 320px;\n box-sizing: border-box;\n }\n}\n\n.walletconnect-modal__base {\n -webkit-font-smoothing: antialiased;\n background: #ffffff;\n border-radius: 24px;\n box-shadow: 0 10px 50px 5px rgba(0, 0, 0, 0.4);\n font-family: ui-rounded, "SF Pro Rounded", "SF Pro Text", medium-content-sans-serif-font,\n -apple-system, BlinkMacSystemFont, ui-sans-serif, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,\n "Open Sans", "Helvetica Neue", sans-serif;\n margin-top: 41px;\n padding: 24px 24px 22px;\n pointer-events: auto;\n position: relative;\n text-align: center;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n will-change: transform;\n overflow: visible;\n transform: translateY(-50%);\n top: 50%;\n max-width: 500px;\n margin: auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__base {\n padding: 24px 12px;\n }\n}\n\n.walletconnect-modal__base .hidden {\n transform: translateY(150%);\n transition: 0.125s cubic-bezier(0.4, 0, 1, 1);\n}\n\n.walletconnect-modal__header {\n align-items: center;\n display: flex;\n height: 26px;\n left: 0;\n justify-content: space-between;\n position: absolute;\n top: -42px;\n width: 100%;\n}\n\n.walletconnect-modal__base .wc-logo {\n align-items: center;\n display: flex;\n height: 26px;\n margin-top: 15px;\n padding-bottom: 15px;\n pointer-events: auto;\n}\n\n.walletconnect-modal__base .wc-logo div {\n background-color: #3399ff;\n height: 21px;\n margin-right: 5px;\n mask-image: url("images/wc-logo.svg") center no-repeat;\n width: 32px;\n}\n\n.walletconnect-modal__base .wc-logo p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n}\n\n.walletconnect-modal__base h2 {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 0 0 19px 0;\n text-align: center;\n width: 100%;\n}\n\n.walletconnect-modal__base__row {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n align-items: center;\n border-radius: 20px;\n cursor: pointer;\n display: flex;\n height: 56px;\n justify-content: space-between;\n padding: 0 15px;\n position: relative;\n margin: 0px 0px 8px;\n text-align: left;\n transition: 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n will-change: transform;\n text-decoration: none;\n}\n\n.walletconnect-modal__base__row:hover {\n background: rgba(60, 66, 82, 0.06);\n}\n\n.walletconnect-modal__base__row:active {\n background: rgba(60, 66, 82, 0.06);\n transform: scale(0.975);\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n}\n\n.walletconnect-modal__base__row__h3 {\n color: #25292e;\n font-size: 20px;\n font-weight: 700;\n margin: 0;\n padding-bottom: 3px;\n}\n\n.walletconnect-modal__base__row__right {\n align-items: center;\n display: flex;\n justify-content: center;\n}\n\n.walletconnect-modal__base__row__right__app-icon {\n border-radius: 8px;\n height: 34px;\n margin: 0 11px 2px 0;\n width: 34px;\n background-size: 100%;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-modal__base__row__right__caret {\n height: 18px;\n opacity: 0.3;\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n width: 8px;\n will-change: opacity;\n}\n\n.walletconnect-modal__base__row:hover .caret,\n.walletconnect-modal__base__row:active .caret {\n opacity: 0.6;\n}\n\n.walletconnect-modal__mobile__toggle {\n width: 80%;\n display: flex;\n margin: 0 auto;\n position: relative;\n overflow: hidden;\n border-radius: 8px;\n margin-bottom: 18px;\n background: #d4d5d9;\n}\n\n.walletconnect-modal__single_wallet {\n display: flex;\n justify-content: center;\n margin-top: 7px;\n margin-bottom: 18px;\n}\n\n.walletconnect-modal__single_wallet a {\n cursor: pointer;\n color: rgb(64, 153, 255);\n font-size: 21px;\n font-weight: 800;\n text-decoration: none !important;\n margin: 0 auto;\n}\n\n.walletconnect-modal__mobile__toggle_selector {\n width: calc(50% - 8px);\n background: white;\n position: absolute;\n border-radius: 5px;\n height: calc(100% - 8px);\n top: 4px;\n transition: all 0.2s ease-in-out;\n transform: translate3d(4px, 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle.right__selected .walletconnect-modal__mobile__toggle_selector {\n transform: translate3d(calc(100% + 12px), 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle a {\n font-size: 12px;\n width: 50%;\n text-align: center;\n padding: 8px;\n margin: 0;\n font-weight: 600;\n z-index: 1;\n}\n\n.walletconnect-modal__footer {\n display: flex;\n justify-content: center;\n margin-top: 20px;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__footer {\n margin-top: 5vw;\n }\n}\n\n.walletconnect-modal__footer a {\n cursor: pointer;\n color: #898d97;\n font-size: 15px;\n margin: 0 auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__footer a {\n font-size: 14px;\n }\n}\n\n.walletconnect-connect__buttons__wrapper {\n max-height: 44vh;\n}\n\n.walletconnect-connect__buttons__wrapper__android {\n margin: 50% 0;\n}\n\n.walletconnect-connect__buttons__wrapper__wrap {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n margin: 10px 0;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__buttons__wrapper__wrap {\n margin-top: 40px;\n }\n}\n\n.walletconnect-connect__button {\n background-color: rgb(64, 153, 255);\n padding: 12px;\n border-radius: 8px;\n text-decoration: none;\n color: rgb(255, 255, 255);\n font-weight: 500;\n}\n\n.walletconnect-connect__button__icon_anchor {\n cursor: pointer;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin: 8px;\n width: 42px;\n justify-self: center;\n flex-direction: column;\n text-decoration: none !important;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-connect__button__icon_anchor {\n margin: 4px;\n }\n}\n\n.walletconnect-connect__button__icon {\n border-radius: 10px;\n height: 42px;\n margin: 0;\n width: 42px;\n background-size: cover !important;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-connect__button__text {\n color: #424952;\n font-size: 2.7vw;\n text-decoration: none !important;\n padding: 0;\n margin-top: 1.8vw;\n font-weight: 600;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__button__text {\n font-size: 16px;\n margin-top: 12px;\n }\n}\n\n.walletconnect-search__input {\n border: none;\n background: #d4d5d9;\n border-style: none;\n padding: 8px 16px;\n outline: none;\n font-style: normal;\n font-stretch: normal;\n font-size: 16px;\n font-style: normal;\n font-stretch: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n border-radius: 8px;\n width: calc(100% - 16px);\n margin: 0;\n margin-bottom: 8px;\n}\n',e.head.appendChild(n)}();var r,o=function(){var e=i.getDocumentOrThrow(),t=e.createElement("div");return t.setAttribute("id","walletconnect-wrapper"),e.body.appendChild(t),t}();a.render(a.createElement(g,{text:(r=i.getNavigatorOrThrow().language.split("-")[0]||"en",y[r]||y.en),uri:e,onClose:v(t),qrcodeModalOptions:n}),o)}(e,t,n)},close:function(){_()||m()}};e.exports=b}).call(this,n(19))},function(e,t,n){const r=n(77),i=n(78),o=n(96),s=n(97);function a(e,t,n,o,s){const a=[].slice.call(arguments,1),c=a.length,u="function"==typeof a[c-1];if(!u&&!r())throw new Error("Callback required as last argument");if(!u){if(c<1)throw new Error("Too few arguments provided");return 1===c?(n=t,t=o=void 0):2!==c||t.getContext||(o=n,n=t,t=void 0),new Promise((function(r,s){try{const s=i.create(n,o);r(e(s,t,o))}catch(e){s(e)}}))}if(c<2)throw new Error("Too few arguments provided");2===c?(s=n,n=t,t=o=void 0):3===c&&(t.getContext&&void 0===s?(s=o,o=void 0):(s=o,o=n,n=t,t=void 0));try{const r=i.create(n,o);s(null,e(r,t,o))}catch(e){s(e)}}t.create=i.create,t.toCanvas=a.bind(null,o.render),t.toDataURL=a.bind(null,o.renderToDataURL),t.toString=a.bind(null,(function(e,t,n){return s.render(e,n)}))},function(e,t){e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},function(e,t,n){const r=n(9),i=n(21),o=n(79),s=n(80),a=n(81),c=n(82),u=n(83),l=n(53),f=n(84),h=n(87),d=n(88),p=n(10),g=n(89);function y(e,t,n){const r=e.size,i=d.getEncodedBits(t,n);let o,s;for(o=0;o<15;o++)s=1==(i>>o&1),o<6?e.set(o,8,s,!0):o<8?e.set(o+1,8,s,!0):e.set(r-15+o,8,s,!0),o<8?e.set(8,r-o-1,s,!0):o<9?e.set(8,15-o-1+1,s,!0):e.set(8,15-o-1,s,!0);e.set(r-8,8,1,!0)}function m(e,t,n){const i=new o;n.forEach((function(t){i.put(t.mode.bit,4),i.put(t.getLength(),p.getCharCountIndicator(t.mode,e)),t.write(i)}));const s=8*(r.getSymbolTotalCodewords(e)-l.getTotalCodewordsCount(e,t));for(i.getLengthInBits()+4<=s&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const a=(s-i.getLengthInBits())/8;for(let e=0;e=0&&t<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===t||6===t)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,o+r,!0,!0):e.set(i+t,o+r,!1,!0))}}(p,t),function(e){const t=e.size;for(let n=8;n=7&&function(e,t){const n=e.size,r=h.getEncodedBits(t);let i,o,s;for(let t=0;t<18;t++)i=Math.floor(t/3),o=t%3+n-8-3,s=1==(r>>t&1),e.set(i,o,s,!0),e.set(o,i,s,!0)}(p,t),function(e,t){const n=e.size;let r=-1,i=n-1,o=7,s=0;for(let a=n-1;a>0;a-=2)for(6===a&&a--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,a-n)){let r=!1;s>>o&1)),e.set(i,a-n,r),o--,-1===o&&(s++,o=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}(p,f),isNaN(i)&&(i=u.getBestMask(p,y.bind(null,p,n))),u.applyMask(i,p),y(p,n,i),{modules:p,version:t,errorCorrectionLevel:n,maskPattern:i,segments:o}}t.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let n,o,s=i.M;return void 0!==t&&(s=i.from(t.errorCorrectionLevel,i.M),n=h.from(t.version),o=u.from(t.maskPattern),t.toSJISFunc&&r.setToSJISFunction(t.toSJISFunc)),v(e,n,s,o)}},function(e,t){function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let n=0;n>>t-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},e.exports=n},function(e,t){function n(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){const i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=n},function(e,t,n){const r=n(9).getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];const t=Math.floor(e/7)+2,n=r(e),i=145===n?26:2*Math.ceil((n-13)/(2*t-2)),o=[n-7];for(let e=1;e=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const t=e.size;let n=0,r=0,i=0,o=null,s=null;for(let a=0;a=5&&(n+=r-5+3),o=t,r=1),t=e.get(c,a),t===s?i++:(i>=5&&(n+=i-5+3),s=t,i=1)}r>=5&&(n+=r-5+3),i>=5&&(n+=i-5+3)}return n},t.getPenaltyN2=function(e){const t=e.size;let n=0;for(let r=0;r=10&&(1488===r||93===r)&&n++,i=i<<1&2047|e.get(s,o),s>=10&&(1488===i||93===i)&&n++}return 40*n},t.getPenaltyN4=function(e){let t=0;const n=e.data.length;for(let r=0;r0){const e=new Uint8Array(this.degree);return e.set(n,i),e}return n},e.exports=i},function(e,t,n){const r=n(86);t.mul=function(e,t){const n=new Uint8Array(e.length+t.length-1);for(let i=0;i=0;){const e=n[0];for(let i=0;i1)return function(e,n){for(let r=1;r<=40;r++)if(l(e,r)<=t.getCapacity(r,n,s.MIXED))return r}(e,i);if(0===e.length)return 1;r=e[0]}else r=e;return function(e,n,r){for(let i=1;i<=40;i++)if(n<=t.getCapacity(i,r,e))return i}(r.mode,r.getLength(),i)},t.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;r.getBCHDigit(t)-c>=0;)t^=7973<=0;)o^=1335<=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(s))},t.rawSplit=function(e){return t.fromArray(d(e,u.isKanjiModeEnabled()))}},function(e,t,n){const r=n(10);function i(e){this.mode=r.NUMERIC,this.data=e.toString()}i.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);const i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,3*i+1))},e.exports=i},function(e,t,n){const r=n(10),i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function o(e){this.mode=r.ALPHANUMERIC,this.data=e}o.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*i.indexOf(this.data[t]);n+=i.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(i.indexOf(this.data[t]),6)},e.exports=o},function(e,t,n){const r=n(93),i=n(10);function o(e){this.mode=i.BYTE,"string"==typeof e&&(e=r(e)),this.data=new Uint8Array(e)}o.getBitsLength=function(e){return 8*e},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){for(let t=0,n=this.data.length;t=55296&&i<=56319&&n>r+1){var o=e.charCodeAt(r+1);o>=56320&&o<=57343&&(i=1024*(i-55296)+o-56320+65536,r+=1)}i<128?t.push(i):i<2048?(t.push(i>>6|192),t.push(63&i|128)):i<55296||i>=57344&&i<65536?(t.push(i>>12|224),t.push(i>>6&63|128),t.push(63&i|128)):i>=65536&&i<=1114111?(t.push(i>>18|240),t.push(i>>12&63|128),t.push(i>>6&63|128),t.push(63&i|128)):t.push(239,191,189)}return new Uint8Array(t).buffer}},function(e,t,n){const r=n(10),i=n(9);function o(e){this.mode=r.KANJI,this.data=e}o.getBitsLength=function(e){return 13*e},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t;for(t=0;t=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}},e.exports=o},function(e,t,n){var r={single_source_shortest_paths:function(e,t,n){var i={},o={};o[t]=0;var s,a,c,u,l,f,h,d=r.PriorityQueue.make();for(d.push(t,0);!d.empty();)for(c in a=(s=d.pop()).value,u=s.cost,l=e[a]||{})l.hasOwnProperty(c)&&(f=u+l[c],h=o[c],(void 0===o[c]||h>f)&&(o[c]=f,d.push(c,f),i[c]=a));if(void 0!==n&&void 0===o[n]){var p=["Could not find a path from ",t," to ",n,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,n){var i=r.single_source_shortest_paths(e,t,n);return r.extract_shortest_path_from_predecessor_list(i,n)},PriorityQueue:{make:function(e){var t,n=r.PriorityQueue,i={};for(t in e=e||{},n)n.hasOwnProperty(t)&&(i[t]=n[t]);return i.queue=[],i.sorter=e.sorter||n.default_sorter,i},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=r},function(e,t,n){const r=n(56);t.render=function(e,t,n){let i=n,o=t;void 0!==i||t&&t.getContext||(i=t,t=void 0),t||(o=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),i=r.getOptions(i);const s=r.getImageWidth(e.modules.size,i),a=o.getContext("2d"),c=a.createImageData(s,s);return r.qrToImageData(c.data,e,i),function(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=n,t.width=n,t.style.height=n+"px",t.style.width=n+"px"}(a,o,s),a.putImageData(c,0,0),o},t.renderToDataURL=function(e,n,r){let i=r;void 0!==i||n&&n.getContext||(i=n,n=void 0),i||(i={});const o=t.render(e,n,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}},function(e,t,n){const r=n(56);function i(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function o(e,t,n){let r=e+t;return void 0!==n&&(r+=" "+n),r}t.render=function(e,t,n){const s=r.getOptions(t),a=e.modules.size,c=e.modules.data,u=a+2*s.margin,l=s.color.light.a?"':"",f="0&&u>0&&e[c-1]||(r+=s?o("M",u+n,.5+l+n):o("m",i,0),i=0,s=!1),u+1',h='viewBox="0 0 '+u+" "+u+'"',d=''+l+f+"\n";return"function"==typeof n&&n(null,d),d}},function(e,t,n){var r=n(99),i={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,o,s,a,c,u,l=!1;t||(t={}),n=t.debug||!1;try{if(s=r(),a=document.createRange(),c=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=i[t.format]||i.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(u),a.selectNodeContents(u),c.addRange(a),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");l=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),l=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),o=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(o,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(a):c.removeAllRanges()),u&&document.body.removeChild(u),s()}return l}},function(e,t){e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;rt.event!==e))}trigger(e){let t,n=[];t=Object(o.isJsonRpcRequest)(e)?e.method:Object(o.isJsonRpcResponseSuccess)(e)||Object(o.isJsonRpcResponseError)(e)?"response:"+e.id:Object(o.isInternalEvent)(e)?e.event:"",t&&(n=this._eventEmitters.filter((e=>e.event===t))),n&&n.length||Object(o.isReservedEvent)(t)||Object(o.isInternalEvent)(t)||(n=this._eventEmitters.filter((e=>"call_request"===e.event))),n.forEach((t=>{if(Object(o.isJsonRpcResponseError)(e)){const n=new Error(e.error.message);t.callback(n,null)}else t.callback(null,e)}))}},c=class{constructor(e="walletconnect"){this.storageId=e}getSession(){let e=null;const t=Object(o.getLocal)(this.storageId);return t&&Object(o.isWalletConnectSession)(t)&&(e=t),e}setSession(e){return Object(o.setLocal)(this.storageId,e),e}removeSession(){Object(o.removeLocal)(this.storageId)}};const u="abcdefghijklmnopqrstuvwxyz0123456789".split("").map((e=>`https://${e}.bridge.walletconnect.org`));var l=class{constructor(e){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new a,this._clientMeta=Object(o.getClientMeta)()||e.connectorOpts.clientMeta||null,this._cryptoLib=e.cryptoLib,this._sessionStorage=e.sessionStorage||new c(e.connectorOpts.storageId),this._qrcodeModal=e.connectorOpts.qrcodeModal,this._qrcodeModalOptions=e.connectorOpts.qrcodeModalOptions,this._signingMethods=[...i.SIGNING_METHODS,...e.connectorOpts.signingMethods||[]],!e.connectorOpts.bridge&&!e.connectorOpts.uri&&!e.connectorOpts.session)throw new Error(i.ERROR_MISSING_REQUIRED);var t;e.connectorOpts.bridge&&(this.bridge=function(e){return"walletconnect.org"===function(e){return function(e){let t=e.indexOf("//")>-1?e.split("/")[2]:e.split("/")[0];return t=t.split(":")[0],t=t.split("?")[0],t}(e).split(".").slice(-2).join(".")}(e)}(t=e.connectorOpts.bridge)?u[Math.floor(Math.random()*u.length)]:t),e.connectorOpts.uri&&(this.uri=e.connectorOpts.uri);const n=e.connectorOpts.session||this._getStorageSession();n&&(this.session=n),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=e.transport||new s.a({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),e.connectorOpts.uri&&this._subscribeToSessionRequest(),e.pushServerOpts&&this._registerPushServer(e.pushServerOpts)}set bridge(e){e&&(this._bridge=e)}get bridge(){return this._bridge}set key(e){if(!e)return;const t=Object(o.convertHexToArrayBuffer)(e);this._key=t}get key(){return this._key?Object(o.convertArrayBufferToHex)(this._key,!0):""}set clientId(e){e&&(this._clientId=e)}get clientId(){let e=this._clientId;return e||(e=this._clientId=Object(o.uuid)()),this._clientId}set peerId(e){e&&(this._peerId=e)}get peerId(){return this._peerId}set clientMeta(e){}get clientMeta(){let e=this._clientMeta;return e||(e=this._clientMeta=Object(o.getClientMeta)()),e}set peerMeta(e){this._peerMeta=e}get peerMeta(){return this._peerMeta}set handshakeTopic(e){e&&(this._handshakeTopic=e)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(e){e&&(this._handshakeId=e)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(e){if(!e)return;const{handshakeTopic:t,bridge:n,key:r}=this._parseUri(e);this.handshakeTopic=t,this.bridge=n,this.key=r}set chainId(e){this._chainId=e}get chainId(){return this._chainId}set networkId(e){this._networkId=e}get networkId(){return this._networkId}set accounts(e){this._accounts=e}get accounts(){return this._accounts}set rpcUrl(e){this._rpcUrl=e}get rpcUrl(){return this._rpcUrl}set connected(e){}get connected(){return this._connected}set pending(e){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(e){e&&(this._connected=e.connected,this.accounts=e.accounts,this.chainId=e.chainId,this.bridge=e.bridge,this.key=e.key,this.clientId=e.clientId,this.clientMeta=e.clientMeta,this.peerId=e.peerId,this.peerMeta=e.peerMeta,this.handshakeId=e.handshakeId,this.handshakeTopic=e.handshakeTopic)}on(e,t){const n={event:e,callback:t};this._eventManager.subscribe(n)}off(e){this._eventManager.unsubscribe(e)}async createInstantRequest(e){this._key=await this._generateKey();const t=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(e)}]});this.handshakeId=t.id,this.handshakeTopic=Object(o.uuid)(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",(()=>{throw new Error(i.ERROR_QRCODE_MODAL_USER_CLOSED)}));const n=()=>{this.killSession()};try{const e=await this._sendCallRequest(t);return e&&n(),e}catch(e){throw n(),e}}async connect(e){if(!this._qrcodeModal)throw new Error(i.ERROR_QRCODE_MODAL_NOT_PROVIDED);return this.connected?{chainId:this.chainId,accounts:this.accounts}:(await this.createSession(e),new Promise((async(e,t)=>{this.on("modal_closed",(()=>t(new Error(i.ERROR_QRCODE_MODAL_USER_CLOSED)))),this.on("connect",((n,r)=>{if(n)return t(n);e(r.params[0])}))})))}async createSession(e){if(this._connected)throw new Error(i.ERROR_SESSION_CONNECTED);if(this.pending)return;this._key=await this._generateKey();const t=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:e&&e.chainId?e.chainId:null}]});this.handshakeId=t.id,this.handshakeTopic=Object(o.uuid)(),this._sendSessionRequest(t,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}approveSession(e){if(this._connected)throw new Error(i.ERROR_SESSION_CONNECTED);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const t={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},n={id:this.handshakeId,jsonrpc:"2.0",result:t};this._sendResponse(n),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(e){if(this._connected)throw new Error(i.ERROR_SESSION_CONNECTED);const t=e&&e.message?e.message:i.ERROR_SESSION_REJECTED,n=this._formatResponse({id:this.handshakeId,error:{message:t}});this._sendResponse(n),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:t}]}),this._removeStorageSession()}updateSession(e){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const t={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},n=this._formatRequest({method:"wc_sessionUpdate",params:[t]});this._sendSessionRequest(n,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}async killSession(e){const t=e?e.message:"Session Disconnected",n=this._formatRequest({method:"wc_sessionUpdate",params:[{approved:!1,chainId:null,networkId:null,accounts:null}]});await this._sendRequest(n),this._handleSessionDisconnect(t)}async sendTransaction(e){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);const t=e,n=this._formatRequest({method:"eth_sendTransaction",params:[t]});return await this._sendCallRequest(n)}async signTransaction(e){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);const t=e,n=this._formatRequest({method:"eth_signTransaction",params:[t]});return await this._sendCallRequest(n)}async signMessage(e){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);const t=this._formatRequest({method:"eth_sign",params:e});return await this._sendCallRequest(t)}async signPersonalMessage(e){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);const t=this._formatRequest({method:"personal_sign",params:e});return await this._sendCallRequest(t)}async signTypedData(e){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);const t=this._formatRequest({method:"eth_signTypedData",params:e});return await this._sendCallRequest(t)}async updateChain(e){if(!this._connected)throw new Error("Session currently disconnected");const t=this._formatRequest({method:"wallet_updateChain",params:[e]});return await this._sendCallRequest(t)}unsafeSend(e,t){return this._sendRequest(e,t),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:t}]}),new Promise(((t,n)=>{this._subscribeToResponse(e.id,((e,r)=>{if(e)n(e);else{if(!r)throw new Error(i.ERROR_MISSING_JSON_RPC);t(r)}}))}))}async sendCustomRequest(e,t){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);switch(e.method){case"eth_accounts":return this.accounts;case"eth_chainId":return Object(o.convertNumberToHex)(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":case"personal_sign":e.params}const n=this._formatRequest(e);return await this._sendCallRequest(n,t)}approveRequest(e){if(!Object(o.isJsonRpcResponseSuccess)(e))throw new Error(i.ERROR_MISSING_RESULT);{const t=this._formatResponse(e);this._sendResponse(t)}}rejectRequest(e){if(!Object(o.isJsonRpcResponseError)(e))throw new Error(i.ERROR_MISSING_ERROR);{const t=this._formatResponse(e);this._sendResponse(t)}}transportClose(){this._transport.close()}async _sendRequest(e,t){const n=this._formatRequest(e),r=await this._encrypt(n),i=void 0!==(null==t?void 0:t.topic)?t.topic:this.peerId,s=JSON.stringify(r),a=void 0!==(null==t?void 0:t.forcePushNotification)?!t.forcePushNotification:Object(o.isSilentPayload)(n);this._transport.send(s,i,a)}async _sendResponse(e){const t=await this._encrypt(e),n=this.peerId,r=JSON.stringify(t);this._transport.send(r,n,!0)}async _sendSessionRequest(e,t,n){this._sendRequest(e,n),this._subscribeToSessionResponse(e.id,t)}_sendCallRequest(e,t){return this._sendRequest(e,t),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:t}]}),this._subscribeToCallResponse(e.id)}_formatRequest(e){if(void 0===e.method)throw new Error(i.ERROR_MISSING_METHOD);return{id:void 0===e.id?Object(o.payloadId)():e.id,jsonrpc:"2.0",method:e.method,params:void 0===e.params?[]:e.params}}_formatResponse(e){if(void 0===e.id)throw new Error(i.ERROR_MISSING_ID);const t={id:e.id,jsonrpc:"2.0"};if(Object(o.isJsonRpcResponseError)(e)){const n=Object(o.formatRpcError)(e.error);return Object.assign(Object.assign(Object.assign({},t),e),{error:n})}if(Object(o.isJsonRpcResponseSuccess)(e))return Object.assign(Object.assign({},t),e);throw new Error(i.ERROR_INVALID_RESPONSE)}_handleSessionDisconnect(e){const t=e||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),Object(o.removeLocal)(i.MOBILE_LINK_CHOICE_KEY)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:t}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(e,t){t&&t.approved?(this._connected?(t.chainId&&(this.chainId=t.chainId),t.accounts&&(this.accounts=t.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,t.chainId&&(this.chainId=t.chainId),t.accounts&&(this.accounts=t.accounts),t.peerId&&!this.peerId&&(this.peerId=t.peerId),t.peerMeta&&!this.peerMeta&&(this.peerMeta=t.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(e)}async _handleIncomingMessages(e){if(![this.clientId,this.handshakeTopic].includes(e.topic))return;let t;try{t=JSON.parse(e.payload)}catch(e){return}const n=await this._decrypt(t);n&&this._eventManager.trigger(n)}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(e,t){this.on("response:"+e,t)}_subscribeToSessionResponse(e,t){this._subscribeToResponse(e,((e,n)=>{e?this._handleSessionResponse(e.message):Object(o.isJsonRpcResponseSuccess)(n)?this._handleSessionResponse(t,n.result):n.error&&n.error.message?this._handleSessionResponse(n.error.message):this._handleSessionResponse(t)}))}_subscribeToCallResponse(e){return new Promise(((t,n)=>{this._subscribeToResponse(e,((e,r)=>{e?n(e):Object(o.isJsonRpcResponseSuccess)(r)?t(r.result):r.error&&r.error.message?n(r.error):n(new Error(i.ERROR_INVALID_RESPONSE))}))}))}_subscribeToInternalEvents(){this.on("display_uri",(()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,(()=>{this._eventManager.trigger({event:"modal_closed",params:[]})}),this._qrcodeModalOptions)})),this.on("connect",(()=>{this._qrcodeModal&&this._qrcodeModal.close()})),this.on("call_request_sent",((e,t)=>{const{request:n}=t.params[0];if(Object(o.isMobile)()&&this._signingMethods.includes(n.method)){const e=Object(o.getLocal)(i.MOBILE_LINK_CHOICE_KEY);e&&(window.location.href=e.href)}})),this.on("wc_sessionRequest",((e,t)=>{e&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:e.toString()}]}),this.handshakeId=t.id,this.peerId=t.params[0].peerId,this.peerMeta=t.params[0].peerMeta;const n=Object.assign(Object.assign({},t),{method:"session_request"});this._eventManager.trigger(n)})),this.on("wc_sessionUpdate",((e,t)=>{e&&this._handleSessionResponse(e.message),this._handleSessionResponse("Session disconnected",t.params[0])}))}_initTransport(){this._transport.on("message",(e=>this._handleIncomingMessages(e))),this._transport.on("open",(()=>this._eventManager.trigger({event:"transport_open",params:[]}))),this._transport.on("close",(()=>this._eventManager.trigger({event:"transport_close",params:[]}))),this._transport.on("error",(()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]}))),this._transport.open()}_formatUri(){return`${this.protocol}:${this.handshakeTopic}@${this.version}?bridge=${encodeURIComponent(this.bridge)}&key=${this.key}`}_parseUri(e){const t=Object(o.parseWalletConnectUri)(e);if(t.protocol===this.protocol){if(!t.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const e=t.handshakeTopic;if(!t.bridge)throw Error("Invalid or missing bridge url parameter value");const n=decodeURIComponent(t.bridge);if(!t.key)throw Error("Invalid or missing key parameter value");return{handshakeTopic:e,bridge:n,key:t.key}}throw new Error(i.ERROR_INVALID_URI)}async _generateKey(){return this._cryptoLib?await this._cryptoLib.generateKey():null}async _encrypt(e){const t=this._key;return this._cryptoLib&&t?await this._cryptoLib.encrypt(e,t):null}async _decrypt(e){const t=this._key;return this._cryptoLib&&t?await this._cryptoLib.decrypt(e,t):null}_getStorageSession(){let e=null;return this._sessionStorage&&(e=this._sessionStorage.getSession()),e}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(e){if(!e.url||"string"!=typeof e.url)throw Error("Invalid or missing pushServerOpts.url parameter value");if(!e.type||"string"!=typeof e.type)throw Error("Invalid or missing pushServerOpts.type parameter value");if(!e.token||"string"!=typeof e.token)throw Error("Invalid or missing pushServerOpts.token parameter value");const t={bridge:this.bridge,topic:this.clientId,type:e.type,token:e.token,peerName:"",language:e.language||""};this.on("connect",(async(n,r)=>{if(n)throw n;if(e.peerMeta){const e=r.params[0].peerMeta.name;t.peerName=e}try{const n=await fetch(e.url+"/new",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)});if(!(await n.json()).success)throw Error("Failed to register in Push Server")}catch(n){throw Error("Failed to register in Push Server")}}))}},f=n(14),h=n(0);async function d(e){const t=(e||256)/8,n=f.randomBytes(t);return Object(o.convertBufferToArrayBuffer)(h.b(n))}async function p(e,t){const n=h.n(e.data),r=h.n(e.iv),i=h.n(e.hmac),o=h.c(i,!1),s=h.j(n,r),a=await f.hmacSha256Sign(t,s),c=h.c(a,!1);return h.A(o)===h.A(c)}async function g(e,t,n){const r=h.f(Object(o.convertArrayBufferToBuffer)(t)),i=n||await d(128),s=h.f(Object(o.convertArrayBufferToBuffer)(i)),a=h.c(s,!1),c=JSON.stringify(e),u=h.C(c),l=await f.aesCbcEncrypt(s,r,u),p=h.c(l,!1),g=h.j(l,s),y=await f.hmacSha256Sign(r,g);return{data:p,hmac:h.c(y,!1),iv:a}}async function y(e,t){const n=h.f(Object(o.convertArrayBufferToBuffer)(t));if(!n)throw new Error("Missing key: required for decryption");if(!await p(e,n))return null;const r=h.n(e.data),i=h.n(e.iv),s=await f.aesCbcDecrypt(i,n,r),a=h.e(s);let c;try{c=JSON.parse(a)}catch(e){return null}return c}t.default=class extends l{constructor(e,t){super({cryptoLib:r,connectorOpts:e,pushServerOpts:t})}}},function(e,t,n){n.r(t),n.d(t,"Component",(function(){return O})),n.d(t,"Fragment",(function(){return _})),n.d(t,"createContext",(function(){return $})),n.d(t,"createElement",(function(){return y})),n.d(t,"createRef",(function(){return v})),n.d(t,"useCallback",(function(){return fe})),n.d(t,"useContext",(function(){return he})),n.d(t,"useDebugValue",(function(){return de})),n.d(t,"useEffect",(function(){return se})),n.d(t,"useErrorBoundary",(function(){return pe})),n.d(t,"useId",(function(){return ge})),n.d(t,"useImperativeHandle",(function(){return ue})),n.d(t,"useLayoutEffect",(function(){return ae})),n.d(t,"useMemo",(function(){return le})),n.d(t,"useReducer",(function(){return oe})),n.d(t,"useRef",(function(){return ce})),n.d(t,"useState",(function(){return ie})),n.d(t,"Children",(function(){return Ae})),n.d(t,"PureComponent",(function(){return Ie})),n.d(t,"StrictMode",(function(){return ht})),n.d(t,"Suspense",(function(){return Le})),n.d(t,"SuspenseList",(function(){return De})),n.d(t,"__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED",(function(){return rt})),n.d(t,"cloneElement",(function(){return at})),n.d(t,"createFactory",(function(){return ot})),n.d(t,"createPortal",(function(){return He})),n.d(t,"default",(function(){return vt})),n.d(t,"findDOMNode",(function(){return ut})),n.d(t,"flushSync",(function(){return ft})),n.d(t,"forwardRef",(function(){return ke})),n.d(t,"hydrate",(function(){return Ge})),n.d(t,"isValidElement",(function(){return st})),n.d(t,"lazy",(function(){return je})),n.d(t,"memo",(function(){return xe})),n.d(t,"render",(function(){return Ke})),n.d(t,"startTransition",(function(){return dt})),n.d(t,"unmountComponentAtNode",(function(){return ct})),n.d(t,"unstable_batchedUpdates",(function(){return lt})),n.d(t,"useDeferredValue",(function(){return pt})),n.d(t,"useInsertionEffect",(function(){return yt})),n.d(t,"useSyncExternalStore",(function(){return mt})),n.d(t,"useTransition",(function(){return gt})),n.d(t,"version",(function(){return it}));var r,i,o,s,a,c,u,l,f={},h=[],d=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function p(e,t){for(var n in t)e[n]=t[n];return e}function g(e){var t=e.parentNode;t&&t.removeChild(e)}function y(e,t,n){var i,o,s,a={};for(s in t)"key"==s?i=t[s]:"ref"==s?o=t[s]:a[s]=t[s];if(arguments.length>2&&(a.children=arguments.length>3?r.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===a[s]&&(a[s]=e.defaultProps[s]);return m(e,a,i,o,null)}function m(e,t,n,r,s){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==s?++o:s};return null==s&&null!=i.vnode&&i.vnode(a),a}function v(){return{current:null}}function _(e){return e.children}function b(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||d.test(t)?n:n+"px"}function w(e,t,n,r,i){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||b(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||b(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r||e.addEventListener(t,o?S:E,o):e.removeEventListener(t,o?S:E,o);else if("dangerouslySetInnerHTML"!==t){if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&-1==t.indexOf("-")?e.removeAttribute(t):e.setAttribute(t,n))}}function E(e){s=!0;try{return this.l[e.type+!1](i.event?i.event(e):e)}finally{s=!1}}function S(e){s=!0;try{return this.l[e.type+!0](i.event?i.event(e):e)}finally{s=!1}}function O(e,t){this.props=e,this.context=t}function R(e,t){if(null==t)return e.__?R(e.__,e.__.__k.indexOf(e)+1):null;for(var n;tt&&a.sort((function(e,t){return e.__v.__b-t.__v.__b})));P.__r=0}function k(e,t,n,r,i,o,s,a,c,u){var l,d,p,g,y,v,b,w=r&&r.__k||h,E=w.length;for(n.__k=[],l=0;l0?m(g.type,g.props,g.key,g.ref?g.ref:null,g.__v):g)){if(g.__=n,g.__b=n.__b+1,null===(p=w[l])||p&&g.key==p.key&&g.type===p.type)w[l]=void 0;else for(d=0;d=0;t--)if((n=e.__k[t])&&(r=M(n)))return r;return null}function L(e,t,n,r,o,s,a,c,u){var l,f,h,d,g,y,m,v,b,w,E,S,R,I,x,C=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(u=n.__h,c=t.__e=n.__e,t.__h=null,s=[c]),(l=i.__b)&&l(t);try{e:if("function"==typeof C){if(v=t.props,b=(l=C.contextType)&&r[l.__c],w=l?b?b.props.value:l.__:r,n.__c?m=(f=t.__c=n.__c).__=f.__E:("prototype"in C&&C.prototype.render?t.__c=f=new C(v,w):(t.__c=f=new O(v,w),f.constructor=C,f.render=B),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=w,f.__n=r,h=f.__d=!0,f.__h=[],f._sb=[]),null==f.__s&&(f.__s=f.state),null!=C.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=p({},f.__s)),p(f.__s,C.getDerivedStateFromProps(v,f.__s))),d=f.props,g=f.state,f.__v=t,h)null==C.getDerivedStateFromProps&&null!=f.componentWillMount&&f.componentWillMount(),null!=f.componentDidMount&&f.__h.push(f.componentDidMount);else{if(null==C.getDerivedStateFromProps&&v!==d&&null!=f.componentWillReceiveProps&&f.componentWillReceiveProps(v,w),!f.__e&&null!=f.shouldComponentUpdate&&!1===f.shouldComponentUpdate(v,f.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),E=0;E2&&(a.children=arguments.length>3?r.call(arguments,2):n),m(e.type,a,i||e.key,o||e.ref,null)}function $(e,t){var n={__c:t="__cC"+l++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some(C)},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}r=h.slice,i={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(t){e=t}throw e}},o=0,s=!1,O.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=p({},this.state),"function"==typeof e&&(e=e(p({},n),this.props)),e&&p(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),C(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),C(this))},O.prototype.render=_,a=[],u="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,P.__r=0,l=0;var V,W,K,G,Y=0,Q=[],J=[],X=i.__b,Z=i.__r,ee=i.diffed,te=i.__c,ne=i.unmount;function re(e,t){i.__h&&i.__h(W,e,Y||t),Y=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:J}),n.__[e]}function ie(e){return Y=1,oe(Ee,e)}function oe(e,t,n){var r=re(V++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ee(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){W.u=!0;var i=W.shouldComponentUpdate;W.shouldComponentUpdate=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter((function(e){return e.__c}));if(o.every((function(e){return!e.__N})))return!i||i.call(this,e,t,n);var s=!1;return o.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))}}return r.__N||r.__}function se(e,t){var n=re(V++,3);!i.__s&&we(n.__H,t)&&(n.__=e,n.i=t,W.__H.__h.push(n))}function ae(e,t){var n=re(V++,4);!i.__s&&we(n.__H,t)&&(n.__=e,n.i=t,W.__h.push(n))}function ce(e){return Y=5,le((function(){return{current:e}}),[])}function ue(e,t,n){Y=6,ae((function(){return"function"==typeof e?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0}),null==n?n:n.concat(e))}function le(e,t){var n=re(V++,7);return we(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function fe(e,t){return Y=8,le((function(){return e}),t)}function he(e){var t=W.context[e.__c],n=re(V++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(W)),t.props.value):e.__}function de(e,t){i.useDebugValue&&i.useDebugValue(t?t(e):e)}function pe(e){var t=re(V++,10),n=ie();return t.__=e,W.componentDidCatch||(W.componentDidCatch=function(e,r){t.__&&t.__(e,r),n[1](e)}),[n[0],function(){n[1](void 0)}]}function ge(){var e=re(V++,11);if(!e.__){for(var t=W.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function ye(){for(var e;e=Q.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(_e),e.__H.__h.forEach(be),e.__H.__h=[]}catch(t){e.__H.__h=[],i.__e(t,e.__v)}}i.__b=function(e){W=null,X&&X(e)},i.__r=function(e){Z&&Z(e),V=0;var t=(W=e.__c).__H;t&&(K===W?(t.__h=[],W.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=J,e.__N=e.i=void 0}))):(t.__h.forEach(_e),t.__h.forEach(be),t.__h=[])),K=W},i.diffed=function(e){ee&&ee(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Q.push(t)&&G===i.requestAnimationFrame||((G=i.requestAnimationFrame)||ve)(ye)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==J&&(e.__=e.__V),e.i=void 0,e.__V=J}))),K=W=null},i.__c=function(e,t){t.some((function(e){try{e.__h.forEach(_e),e.__h=e.__h.filter((function(e){return!e.__||be(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],i.__e(n,e.__v)}})),te&&te(e,t)},i.unmount=function(e){ne&&ne(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{_e(e)}catch(e){t=e}})),n.__H=void 0,t&&i.__e(t,n.__v))};var me="function"==typeof requestAnimationFrame;function ve(e){var t,n=function(){clearTimeout(r),me&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);me&&(t=requestAnimationFrame(n))}function _e(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function be(e){var t=W;e.__c=e.__(),W=t}function we(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Ee(e,t){return"function"==typeof t?t(e):t}function Se(e,t){for(var n in t)e[n]=t[n];return e}function Oe(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function Re(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t}function Ie(e){this.props=e}function xe(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:Oe(this.props,e)}function r(t){return this.shouldComponentUpdate=n,y(e,t)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(Ie.prototype=new O).isPureReactComponent=!0,Ie.prototype.shouldComponentUpdate=function(e,t){return Oe(this.props,e)||Oe(this.state,t)};var Ce=i.__b;i.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ce&&Ce(e)};var Pe="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function ke(e){function t(t){var n=Se({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Pe,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Ne=function(e,t){return null==e?null:A(A(e).map(t))},Ae={map:Ne,forEach:Ne,count:function(e){return e?A(e).length:0},only:function(e){var t=A(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:A},Te=i.__e;i.__e=function(e,t,n,r){if(e.then)for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);Te(e,t,n,r)};var Me=i.unmount;function Le(){this.__u=0,this.t=null,this.__b=null}function Ue(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function je(e){var t,n,r;function i(i){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){r=e})),r)throw r;if(!n)throw t;return y(n,i)}return i.displayName="Lazy",i.__f=!0,i}function De(){this.u=null,this.o=null}i.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&!0===e.__h&&(e.type=null),Me&&Me(e)},(Le.prototype=new O).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var i=Ue(r.__v),o=!1,s=function(){o||(o=!0,n.__R=null,i?i(a):a())};n.__R=s;var a=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=function e(t,n,r){return t&&(t.__v=null,t.__k=t.__k&&t.__k.map((function(t){return e(t,n,r)})),t.__c&&t.__c.__P===n&&(t.__e&&r.insertBefore(t.__e,t.__d),t.__c.__e=!0,t.__c.__P=r)),t}(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}},c=!0===t.__h;r.__u++||c||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},Le.prototype.componentWillUnmount=function(){this.t=[]},Le.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=function e(t,n,r){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),t.__c.__H=null),null!=(t=Se({},t)).__c&&(t.__c.__P===r&&(t.__c.__P=n),t.__c=null),t.__k=t.__k&&t.__k.map((function(t){return e(t,n,r)}))),t}(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&y(_,null,e.fallback);return i&&(i.__h=null),[y(_,null,t.__a?null:e.children),i]};var ze=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),t.i.removeChild(e)}}),F(y(Be,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function He(e,t){var n=y(Fe,{__v:e,i:t});return n.containerInfo=t,n}(De.prototype=new O).__a=function(e){var t=this,n=Ue(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),ze(t,e,r)):i()};n?n(o):o()}},De.prototype.render=function(e){this.u=null,this.o=new Map;var t=A(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},De.prototype.componentDidUpdate=De.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){ze(e,n,t)}))};var qe="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,$e=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ve="undefined"!=typeof document,We=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(e)};function Ke(e,t,n){return null==t.__k&&(t.textContent=""),F(e,t),"function"==typeof n&&n(),e?e.__c:null}function Ge(e,t,n){return H(e,t),"function"==typeof n&&n(),e?e.__c:null}O.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(O.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var Ye=i.event;function Qe(){}function Je(){return this.cancelBubble}function Xe(){return this.defaultPrevented}i.event=function(e){return Ye&&(e=Ye(e)),e.persist=Qe,e.isPropagationStopped=Je,e.isDefaultPrevented=Xe,e.nativeEvent=e};var Ze,et={configurable:!0,get:function(){return this.class}},tt=i.vnode;i.vnode=function(e){var t=e.type,n=e.props,r=n;if("string"==typeof t){var i=-1===t.indexOf("-");for(var o in r={},n){var s=n[o];Ve&&"children"===o&&"noscript"===t||"value"===o&&"defaultValue"in n&&null==s||("defaultValue"===o&&"value"in n&&null==n.value?o="value":"download"===o&&!0===s?s="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+t)&&!We(n.type)?o="oninput":/^onfocus$/i.test(o)?o="onfocusin":/^onblur$/i.test(o)?o="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(o)?o=o.toLowerCase():i&&$e.test(o)?o=o.replace(/[A-Z0-9]/g,"-$&").toLowerCase():null===s&&(s=void 0),/^oninput$/i.test(o)&&(o=o.toLowerCase(),r[o]&&(o="oninputCapture")),r[o]=s)}"select"==t&&r.multiple&&Array.isArray(r.value)&&(r.value=A(n.children).forEach((function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)}))),"select"==t&&null!=r.defaultValue&&(r.value=A(n.children).forEach((function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),e.props=r,n.class!=n.className&&(et.enumerable="className"in n,null!=n.className&&(r.class=n.className),Object.defineProperty(r,"className",et))}e.$$typeof=qe,tt&&tt(e)};var nt=i.__r;i.__r=function(e){nt&&nt(e),Ze=e.__c};var rt={ReactCurrentDispatcher:{current:{readContext:function(e){return Ze.__n[e.__c].props.value}}}},it="17.0.2";function ot(e){return y.bind(null,e)}function st(e){return!!e&&e.$$typeof===qe}function at(e){return st(e)?q.apply(null,arguments):e}function ct(e){return!!e.__k&&(F(null,e),!0)}function ut(e){return e&&(e.base||1===e.nodeType&&e)||null}var lt=function(e,t){return e(t)},ft=function(e,t){return e(t)},ht=_;function dt(e){e()}function pt(e){return e}function gt(){return[!1,dt]}var yt=ae;function mt(e,t){var n=t(),r=ie({h:{__:n,v:t}}),i=r[0].h,o=r[1];return ae((function(){i.__=n,i.v=t,Re(i.__,t())||o({h:i})}),[e,n,t]),se((function(){return Re(i.__,i.v())||o({h:i}),e((function(){Re(i.__,i.v())||o({h:i})}))}),[e]),n}var vt={useState:ie,useId:ge,useReducer:oe,useEffect:se,useLayoutEffect:ae,useInsertionEffect:ae,useTransition:gt,useDeferredValue:pt,useSyncExternalStore:mt,startTransition:dt,useRef:ce,useImperativeHandle:ue,useMemo:le,useCallback:fe,useContext:he,useDebugValue:de,version:"17.0.2",Children:Ae,render:Ke,hydrate:Ge,unmountComponentAtNode:ct,createPortal:He,createElement:y,createContext:$,createFactory:ot,cloneElement:at,createRef:v,Fragment:_,isValidElement:st,findDOMNode:ut,Component:O,PureComponent:Ie,memo:xe,forwardRef:ke,flushSync:ft,unstable_batchedUpdates:lt,StrictMode:_,Suspense:Le,SuspenseList:De,lazy:je,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:rt}},function(e,t,n){n.r(t),n.d(t,"JsonRpcProvider",(function(){return o}));var r=n(13),i=n(7);class o extends i.IJsonRpcProvider{constructor(e){super(e),this.events=new r.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Object(i.formatJsonRpcRequest)(e.method,e.params||[]),t)}async requestStrict(e,t){return new Promise((async(n,r)=>{if(!this.connection.connected)try{await this.open()}catch(e){r(e)}this.events.on(""+e.id,(e=>{Object(i.isJsonRpcError)(e)?r(e.error):n(e.result)}));try{await this.connection.send(e,t)}catch(e){r(e)}}))}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Object(i.isJsonRpcResponse)(e)?this.events.emit(""+e.id,e):this.events.emit("message",{type:e.method,data:e.params})}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",(e=>this.onPayload(e))),this.connection.on("close",(()=>this.events.emit("disconnect"))),this.connection.on("error",(e=>this.events.emit("error",e))),this.hasRegisteredEventListeners=!0)}}var s=o;t.default=s},function(e,t,n){n.r(t),n.d(t,"HttpConnection",(function(){return u}));var r=n(13),i=n(23),o=n.n(i),s=n(12),a=n(7);const c={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class u{constructor(e){if(this.url=e,this.events=new r.EventEmitter,this.isAvailable=!1,this.registering=!1,!Object(a.isHttpUrl)(e))throw new Error("Provided URL is not compatible with HTTP connection: "+e);this.url=e}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e,t){this.isAvailable||await this.register();try{const t=Object(s.b)(e),n=await o()(this.url,Object.assign(Object.assign({},c),{body:t})),r=await n.json();this.onPayload({data:r})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!Object(a.isHttpUrl)(e))throw new Error("Provided URL is not compatible with HTTP connection: "+e);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),void 0===this.isAvailable)return t(new Error("HTTP connection is missing or invalid"));e()}))}))}this.url=e,this.registering=!0;try{const t=Object(s.b)({id:1,jsonrpc:"2.0",method:"test",params:[]});await o()(e,Object.assign(Object.assign({},c),{body:t})),this.onOpen()}catch(e){const t=this.parseError(e);throw this.events.emit("register_error",t),this.onClose(),t}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(void 0===e.data)return;const t="string"==typeof e.data?Object(s.a)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),r=n.message||n.toString(),i=Object(a.formatJsonRpcError)(e,r);this.events.emit("payload",i)}parseError(e,t=this.url){return Object(a.parseConnectionError)(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}}var l=u;t.default=l}])}(g);var y,m=d(g.exports),v={exports:{}},_={},b={exports:{}},w={};!function(e){e.exports=function(){if(y)return w;y=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),f=Symbol.iterator,h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},d=Object.assign,p={};function g(e,t,n){this.props=e,this.context=t,this.refs=p,this.updater=n||h}function m(){}function v(e,t,n){this.props=e,this.context=t,this.refs=p,this.updater=n||h}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},m.prototype=g.prototype;var _=v.prototype=new m;_.constructor=v,d(_,g.prototype),_.isPureReactComponent=!0;var b=Array.isArray,E=Object.prototype.hasOwnProperty,S={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function R(t,n,r){var i,o={},s=null,a=null;if(null!=n)for(i in void 0!==n.ref&&(a=n.ref),void 0!==n.key&&(s=""+n.key),n)E.call(n,i)&&!O.hasOwnProperty(i)&&(o[i]=n[i]);var c=arguments.length-2;if(1===c)o.children=r;else if(1d)&&(z=(H=H.replace(" ",":")).length),0r&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(y,"$1"+e.trim());case 58:return e.trim()+t.replace(y,"$1"+e.trim());default:if(0<1*n&&0c.charCodeAt(8))break;case 115:s=s.replace(c,"-webkit-"+c)+";"+s;break;case 207:case 102:s=s.replace(c,"-webkit-"+(102r.charCodeAt(0)&&(r=r.trim()),r=[r],01?t-1:0),r=1;r0?" Args: "+n.join(", "):""))}var ne=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,n=0;n=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,i=r;e>=i;)(i<<=1)<0&&te(16,""+e);this.groupSizes=new Uint32Array(i),this.groupSizes.set(n),this.length=i;for(var o=r;o=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),i=r+n,o=r;o=oe&&(oe=t+1),re.set(e,t),ie.set(t,e)},ue="style["+X+'][data-styled-version="5.3.11"]',le=new RegExp("^"+X+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),fe=function(e,t,n){for(var r,i=n.split(","),o=0,s=i.length;o=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(X))return r}}(r),s=void 0!==o?o.nextSibling:null;i.setAttribute(X,"active"),i.setAttribute("data-styled-version","5.3.11");var a=n.nc;return a&&i.setAttribute("nonce",a),r.insertBefore(i,s),i},pe=function(){function e(e){var t=this.element=de(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e0&&(u+=e+",")})),r+=""+a+c+'{content:"'+u+'"}/*!sc*/\n'}}}return r}(this)},e}(),be=/(a)(d)/gi,we=function(e){return String.fromCharCode(e+(e>25?39:97))};function Ee(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=we(t%52)+n;return(we(t%52)+n).replace(be,"$1-$2")}var Se=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Oe=function(e){return Se(5381,e)},Re=Oe("5.3.11"),Ie=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic=(void 0===n||n.isStatic)&&function(e){for(var t=0;t>>0);if(!t.hasNameForId(r,s)){var a=n(o,"."+s,void 0,r);t.insertRules(r,s,a)}i.push(s),this.staticRulesId=s}else{for(var c=this.rules.length,u=Se(this.baseHash,n.hash),l="",f=0;f>>0);if(!t.hasNameForId(r,g)){var y=n(l,"."+g,void 0,r);t.insertRules(r,g,y)}i.push(g)}}return i.join(" ")},e}(),xe=/^\s*\/\/.*$/gm,Ce=[":","[",".","#"],Pe=S.createContext();Pe.Consumer;var ke=S.createContext(),Ne=(ke.Consumer,new _e),Ae=function(e){var t,n,r,i,o=G,s=o.options,a=void 0===s?G:s,c=o.plugins,u=void 0===c?K:c,l=new x(a),f=[],h=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,i,o,s,a,c,u,l,f){switch(n){case 1:if(0===l&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===u)return r+"/*|*/";break;case 3:switch(u){case 102:case 112:return e(i[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),d=function(e,r,o){return 0===r&&-1!==Ce.indexOf(o[n.length])||o.match(i)?e:"."+t};function p(e,o,s,a){void 0===a&&(a="&");var c=e.replace(xe,""),u=o&&s?s+" "+o+" { "+c+" }":c;return t=a,n=o,r=new RegExp("\\"+n+"\\b","g"),i=new RegExp("(\\"+n+"\\b){2,}"),l(s||!o?"":o,u)}return l.use([].concat(u,[function(e,t,i){2===e&&i.length&&i[0].lastIndexOf(n)>0&&(i[0]=i[0].replace(r,d))},h,function(e){if(-2===e){var t=f;return f=[],t}}])),p.hash=u.length?u.reduce((function(e,t){return t.name||te(15),Se(e,t.name)}),5381).toString():"",p}(),Te=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=Ae);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.toString=function(){return te(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=Ae),this.name+e.hash},e}(),Me=/([A-Z])/,Le=/([A-Z])/g,Ue=/^ms-/,je=function(e){return"-"+e.toLowerCase()};function De(e){return Me.test(e)?e.replace(Le,je).replace(Ue,"-ms-"):e}var ze=function(e){return null==e||!1===e||""===e};function Be(e,t,n,r){if(Array.isArray(e)){for(var i,o=[],s=0,a=e.length;s1?t-1:0),r=1;r?@[\\\]^`{|}~-]+/g,$e=/(^-|-$)/g;function Ve(e){return e.replace(qe,"-").replace($e,"")}function We(e){return"string"==typeof e&&!0}var Ke=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},Ge=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function Ye(e,t,n){var r=e[n];Ke(t)&&Ke(r)?Qe(r,t):e[n]=t}function Qe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r>>0)}("5.3.11"+n+Xe[n]);return t?t+"-"+r:r}(t.displayName,t.parentComponentId):a,u=t.displayName,l=void 0===u?function(e){return We(e)?"styled."+e:"Styled("+Q(e)+")"}(e):u,f=t.displayName&&t.componentId?Ve(t.displayName)+"-"+t.componentId:t.componentId||c,h=r&&e.attrs?Array.prototype.concat(e.attrs,s).filter(Boolean):s,d=t.shouldForwardProp;r&&e.shouldForwardProp&&(d=t.shouldForwardProp?function(n,r,i){return e.shouldForwardProp(n,r,i)&&t.shouldForwardProp(n,r,i)}:e.shouldForwardProp);var p,g=new Ie(n,f,r?e.componentStyle:void 0),y=g.isStatic&&0===s.length,m=function(e,t){return function(e,t,n,r){var i=e.attrs,o=e.componentStyle,s=e.defaultProps,a=e.foldedComponentIds,c=e.shouldForwardProp,u=e.styledComponentId,l=e.target,f=function(e,t,n){void 0===e&&(e=G);var r=$({},t,{theme:e}),i={};return n.forEach((function(e){var t,n,o,s=e;for(t in Y(s)&&(s=s(r)),s)r[t]=i[t]="className"===t?(n=i[t],o=s[t],n&&o?n+" "+o:n||o):s[t]})),[r,i]}(function(e,t,n){return void 0===n&&(n=G),e.theme!==n.theme&&e.theme||t||n.theme}(t,b.exports.useContext(Je),s)||G,t,i),h=f[0],d=f[1],p=function(e,t,n,r){var i=b.exports.useContext(Pe)||Ne,o=b.exports.useContext(ke)||Ae;return t?e.generateAndInjectStyles(G,i,o):e.generateAndInjectStyles(n,i,o)}(o,r,h),g=n,y=d.$as||t.$as||d.as||t.as||l,m=We(y),v=d!==t?$({},t,{},d):t,_={};for(var w in v)"$"!==w[0]&&"as"!==w&&("forwardedAs"===w?_.as=v[w]:(c?c(w,k,y):!m||k(w))&&(_[w]=v[w]));return t.style&&d.style!==t.style&&(_.style=$({},t.style,{},d.style)),_.className=Array.prototype.concat(a,u,p!==u?p:null,t.className,d.className).filter(Boolean).join(" "),_.ref=g,b.exports.createElement(y,_)}(p,e,t,y)};return m.displayName=l,(p=S.forwardRef(m)).attrs=h,p.componentStyle=g,p.displayName=l,p.shouldForwardProp=d,p.foldedComponentIds=r?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):K,p.styledComponentId=f,p.target=r?e.target:e,p.withComponent=function(e){var r=t.componentId,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(t,["componentId"]),o=r&&r+"-"+(We(e)?e:Ve(Q(e)));return Ze(e,$({},i,{attrs:h,componentId:o}),n)},Object.defineProperty(p,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=r?Qe({},e.defaultProps,t):t}}),Object.defineProperty(p,"toString",{value:function(){return"."+p.styledComponentId}}),i&&q(p,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),p}var et=function(e){return function e(t,n,r){if(void 0===r&&(r=G),!R.exports.isValidElementType(n))return te(1,String(n));var i=function(){return t(n,r,He.apply(void 0,arguments))};return i.withConfig=function(i){return e(t,n,$({},r,{},i))},i.attrs=function(i){return e(t,n,$({},r,{attrs:Array.prototype.concat(r.attrs,i).filter(Boolean)}))},i}(Ze,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach((function(e){et[e]=et(e)}));const tt=et.div` + z-index: 998; + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.6); + transition: opacity .25s; +`,nt="only screen and (min-width: 640px)",rt="only screen and (max-height: 640px)",it="1.2rem",ot=et.div` + z-index: 999; + position: fixed; + top: 0px; + left: 0px; + width: 100vw; + height: 100%; + + font: 14px inter, sans-serif; + font-family: "Segoe UI", Helvetica, Arial, sans-serif; + font-feature-settings: "kern"; + text-align: left !important; + + display: flex; + flex-direction: column; + justify-content: end; + align-items: center; + + @media ${nt} { + justify-content: start; + align-items: end; + } +`,st=et.div` + position: relative; + bottom: 0px; + left: 0px; + width: 100%; + border-radius: ${it} ${it} 0 0; + background: #131214; + + transform: scale(1); + transition: opacity .25s,transform .25s; + + @media ${nt} { + max-width: 340px; + margin: auto; + border-radius: ${it}; + } +`,at=et.button` + box-sizing: border-box; + margin: 0.2rem 0.2rem 0 0; + border: none; + padding: 0; + width: 18px; + height: 18px; + background: transparent; + outline: none; + cursor: pointer; + + & > img { + width: 18px; + height: 18px; + } +`,ct="15px",ut=et.div` + display: flex; + flex: 1; + flex-direction: row; + justify-content: space-between; + padding: ${ct}; + padding-bottom: 0.9rem; +`,lt=et.div` + margin-bottom: ${ct}; + border-top: 1px solid #2b2a2b; + padding: ${ct} ${ct} 0 ${ct}; + color: #C3C3C3; + + ${({textAlign:e})=>e&&He` + text-align: ${e}; + `} +`,ft=et.h2` + color: #fff; + margin: 0; + line-height: 28px; + font-size: 24px; + font-weight: 600; + + @media ${rt} { + font-size: 18px; + } +`;et.h3` + color: #fff; + margin: 0; + font-size: 20px; + font-weight: 500; + line-height: 24px; +`;const ht=et.p` + ${({noMargin:e})=>e?He` + margin: 0; + `:"\n margin: 12px 0 0 0;\n "} + font-size: 14px; + font-weight: 500; + line-height: 20px; +`,dt=et.button` + width: 100%; + + ${({extraMargin:e})=>e?He` + margin: 2rem 0 1.2rem 0; + `:He` + margin-top: 1.2rem; + `} + + border-radius: 3rem; + padding: 0.8rem 1rem; + + font-size: 14px; + font-weight: 600; + line-height: 17px; + + transition: all .5s ease; + cursor: pointer; + + ${({variant:e})=>"primary"==e?He` + border: none; + background-color: white; + color: #000; + &:hover, &:focus { + background-color: rgba(255, 255, 255, 0.8); + } + `:He` + border: 1px solid #565656; + background-color: transparent; + color: #fff; + &:hover { + background-color: rgba(255, 255, 255, 0.05); + } + `} +`,pt=et.a` + color: #BBB0FF; + cursor: pointer; +`;let gt=e=>{};const yt=({onClose:e,children:t})=>{const[n,r]=b.exports.useState(!0);gt=r;const i=()=>{gt(!1),e&&e()};return n?v.exports.jsxs(v.exports.Fragment,{children:[v.exports.jsx(tt,{}),v.exports.jsx(ot,Object.assign({id:"ModalWrapper",onClick:e=>{var t;"ModalWrapper"===(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.id)&&i()}},{children:v.exports.jsxs(st,{children:[v.exports.jsxs(ut,{children:[v.exports.jsx("img",{src:"data:image/svg+xml,%3csvg width='72' height='24' viewBox='0 0 72 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M61.3616 22.4887V23.9996H71.7318V17.1853H70.2208V22.4887H61.3616ZM61.3616 0V1.51096H70.2208V6.81473H71.7318V0H61.3616ZM56.0137 11.689V8.17796H58.3842C59.5398 8.17796 59.9546 8.56305 59.9546 9.61506V10.2372C59.9546 11.3186 59.5545 11.689 58.3842 11.689H56.0137ZM59.7764 12.311C60.8578 12.0296 61.6133 11.022 61.6133 9.82231C61.6133 9.06683 61.3172 8.38521 60.7542 7.83698C60.0432 7.15536 59.0948 6.81473 57.8653 6.81473H54.5322V17.1849H56.0137V13.0518H58.2361C59.3767 13.0518 59.836 13.5258 59.836 14.7112V17.1853H61.3469V14.9482C61.3469 13.3186 60.9618 12.6965 59.7764 12.5187V12.311ZM47.303 12.6517H51.866V11.2888H47.303V8.17761H52.3102V6.81473H45.7916V17.1849H52.5325V15.822H47.303V12.6517ZM42.3398 13.1999V13.9109C42.3398 15.4072 41.7916 15.8963 40.414 15.8963H40.0881C38.7102 15.8963 38.0436 15.4516 38.0436 13.3925V10.6072C38.0436 8.53329 38.7399 8.10338 40.1175 8.10338H40.4137C41.7618 8.10338 42.1914 8.60716 42.2061 9.99979H43.8357C43.6876 7.9553 42.3248 6.66665 40.2803 6.66665C39.2878 6.66665 38.4581 6.97787 37.836 7.57021C36.9027 8.44437 36.3842 9.92593 36.3842 11.9998C36.3842 13.9999 36.8288 15.4814 37.7471 16.3997C38.3692 17.0071 39.2286 17.333 40.073 17.333C40.9619 17.333 41.7769 16.9773 42.1914 16.2071H42.3986V17.1849H43.7615V11.837H39.7467V13.1999H42.3398ZM29.2737 8.17761H30.8886C32.4146 8.17761 33.2443 8.5627 33.2443 10.6369V13.3627C33.2443 15.4366 32.4146 15.822 30.8886 15.822H29.2737V8.17761ZM31.0216 17.1853C33.8513 17.1853 34.903 15.0372 34.903 12.0002C34.903 8.91874 33.7771 6.81509 30.9919 6.81509H27.7917V17.1853H31.0216ZM20.6367 12.6517H25.1997V11.2888H20.6367V8.17761H25.644V6.81473H19.1254V17.1849H25.8663V15.822H20.6367V12.6517ZM11.8962 6.81473H10.3852V17.1849H17.2V15.822H11.8962V6.81473ZM0 17.1853V24H10.3702V22.4887H1.51096V17.1853H0ZM0 0V6.81473H1.51096V1.51096H10.3702V0H0Z' fill='white'/%3e%3c/svg%3e"}),v.exports.jsx(at,Object.assign({onClick:i},{children:v.exports.jsx("img",{src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M22 2L2 22' stroke='white' stroke-width='3'/%3e%3cpath d='M2 2L22 22' stroke='white' stroke-width='3'/%3e%3c/svg%3e"})}))]}),v.exports.jsx(v.exports.Fragment,{children:t})]})}))]}):null};var mt,vt,_t,bt,wt={exports:{}},Et={},St={exports:{}},Ot={};function Rt(){return vt||(vt=1,function(e){e.exports=(mt||(mt=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0>>1,o=e[r];if(!(0>>1;ri(c,n))ui(l,c)?(e[r]=l,e[u]=n,r=u):(e[r]=c,e[a]=n,r=a);else{if(!(ui(l,n)))break e;e[r]=l,e[u]=n,r=u}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var c=[],u=[],l=1,f=null,h=3,d=!1,p=!1,g=!1,y="function"==typeof setTimeout?setTimeout:null,m="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function _(e){for(var i=n(u);null!==i;){if(null===i.callback)r(u);else{if(!(i.startTime<=e))break;r(u),i.sortIndex=i.expirationTime,t(c,i)}i=n(u)}}function b(e){if(g=!1,_(e),!p)if(null!==n(c))p=!0,A(w);else{var t=n(u);null!==t&&T(b,t.startTime-e)}}function w(t,i){p=!1,g&&(g=!1,m(R),R=-1),d=!0;var o=h;try{for(_(i),f=n(c);null!==f&&(!(f.expirationTime>i)||t&&!C());){var s=f.callback;if("function"==typeof s){f.callback=null,h=f.priorityLevel;var a=s(f.expirationTime<=i);i=e.unstable_now(),"function"==typeof a?f.callback=a:f===n(c)&&r(c),_(i)}else r(c);f=n(c)}if(null!==f)var l=!0;else{var y=n(u);null!==y&&T(b,y.startTime-i),l=!1}return l}finally{f=null,h=o,d=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var E,S=!1,O=null,R=-1,I=5,x=-1;function C(){return!(e.unstable_now()-xe||125s?(r.sortIndex=o,t(u,r),null===n(c)&&r===n(u)&&(g?(m(R),R=-1):g=!0,T(b,o-s))):(r.sortIndex=a,t(c,r),p||d||(p=!0,A(w))),r},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}}(Ot)),Ot)}(St)),St.exports}function It(){if(_t)return Et;_t=1;var e=b.exports,t=Rt();function n(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n